Giter VIP home page Giter VIP logo

Comments (7)

Thom1729 avatar Thom1729 commented on June 9, 2024 1

In this particular case, which uses the || operator, I could hack around it (such a hack is already in place for TypeScript), but the bug would still appear in foo < bar | baz < xyzzy. I'm currently opening a core issue for a change that would help, but that's not a short-term solution (or a guaranteed solution at all).

I might come up with a clean solution, and if that fails I'll probably implement a dirty one, but I'd use parens there in the meantime.

from babel-sublime.

Thom1729 avatar Thom1729 commented on June 9, 2024 1

Should be fixed in v11.1.1. It's the hacky fix, not a clean one, but it should do the right thing in most cases and it shouldn't make anything worse.

from babel-sublime.

Thom1729 avatar Thom1729 commented on June 9, 2024

Can you paste an example as text?

from babel-sublime.

Mariede avatar Mariede commented on June 9, 2024

Can you paste an example as text?

sure, I will paste the head of the function together with the scoped validation function where code starts to break the highlight.

Starts here:

(checkVazaoFimEscala < checkVazaoMaximo || (checkVazaoMaximo < checkVazaoNormal) || (checkVazaoNormal < checkVazaoMinimo))

Strange but this same code does not break the highlight inside a functional react component.

const calculate1 = async (req, res) => {
	// Parametros de sessao


		...


	// Validacoes nos valores recebidos
	const _validateData = ( ... some params ... ) => {
		const limitsValues = enumData.validateLimitsValues;
		const errorStack = [];
		const decimalsAfter = 6;


		...


		_limitsCheck(
			errorStack,
			_valorTemperaturaAfterCooler,
			limitsValues.temperatura[0],
			limitsValues.temperatura[1],
			`Umidade relativa: temperatura (aftercooler ou outro) deve estar entre ${functions.formatNumberToString(limitsValues.temperatura[0])} ${temperaturaUnidadePadrao} e ${functions.formatNumberToString(limitsValues.temperatura[1])} ${temperaturaUnidadePadrao} (${functions.formatNumberToString(_valorTemperaturaAfterCooler)} ${temperaturaUnidadePadrao})`
		);

		// Valor viscosidade dinamica
		_limitsCheck(
			errorStack,
			_valorViscosidadeDinamica,
			limitsValues.viscosidadeDinamica[0],
			limitsValues.viscosidadeDinamica[1],
			`Viscosidade dinâmica: valor deve estar entre ${functions.formatNumberToString(limitsValues.viscosidadeDinamica[0])} e ${functions.formatNumberToString(limitsValues.viscosidadeDinamica[1])} (${functions.formatNumberToString(_valorViscosidadeDinamica)})`
		);
		// -------------------------------

		// Checagem vazao (minimo e maximo)
		if (_valorVazaoMinimo !== '' || _valorVazaoNormal !== '' || _valorVazaoMaximo !== '' || _valorVazaoFimEscala !== '') {
			const checkVazaoMinimo = (_valorVazaoMinimo === '' || _valorVazaoMinimo === 0 ? (_valorVazaoNormal || 0) : _valorVazaoMinimo);
			const checkVazaoNormal = (_valorVazaoNormal === '' ? 0 : _valorVazaoNormal); // Vazao normal sempre presente
			const checkVazaoMaximo = (_valorVazaoMaximo === '' || _valorVazaoMaximo === 0 ? (_valorVazaoFimEscala || _valorVazaoNormal || 0) : _valorVazaoMaximo);
			const checkVazaoFimEscala = (_valorVazaoFimEscala === '' ? (_valorVazaoMaximo || _valorVazaoNormal || 0) : _valorVazaoFimEscala);

			if (checkVazaoFimEscala < checkVazaoMaximo || (checkVazaoMaximo < checkVazaoNormal) || (checkVazaoNormal < checkVazaoMinimo)) {
				errorStack.push('Vazão: valor de fim de escala deve ser maior ou igual ao valor máximo, que deve ser maior ou igual ao valor normal, que deve ser maior ou igual ao valor mínimo (caso exista)');
			}
		}
		// -------------------------------

		// Checagem pressao diferencial (minimo e maximo)
		if (_valorPressaoDiferencialNormal !== '' || _valorPressaoDiferencialFimEscala !== '') {
			const checkPressaoDiferencialNormal = (_valorPressaoDiferencialNormal === '' ? (_valorPressaoDiferencialFimEscala || 0) : _valorPressaoDiferencialNormal);
			const checkPressaoDiferencialFimEscala = (_valorPressaoDiferencialFimEscala === '' ? (_valorPressaoDiferencialNormal || 0) : _valorPressaoDiferencialFimEscala);

			if (checkPressaoDiferencialFimEscala < checkPressaoDiferencialNormal) {
				errorStack.push('Pressão diferencial: valor de fim de escala deve ser maior ou igual ao valor normal (caso exista)');
			}
		}
		// -------------------------------




		...


from babel-sublime.

Thom1729 avatar Thom1729 commented on June 9, 2024

Looks like the problem is that the < in checkVazaoFimEscala < is being parsed as the beginning of function type arguments. This is almost certainly a bug in the Flow extension. It looks like it's pretty hard to trigger — you need something like foo < bar < baz, or foo < bar | baz < xyzzy.

I'll take a look. There may be a similar bug in the core TypeScript definition as well.

from babel-sublime.

Mariede avatar Mariede commented on June 9, 2024

wow looks bigger than i thought... if you need help with some other test let me know ok. Thanks

from babel-sublime.

Mariede avatar Mariede commented on June 9, 2024

Although it is not a clean solution, it is a welcome help! Thank's

from babel-sublime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.