Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Lint for no unneeded backticks #5057

Merged
merged 9 commits into from
Dec 29, 2022
Merged

Conversation

ivov
Copy link
Contributor

@ivov ivov commented Dec 29, 2022

Wrote tests for this but the RuleTester parser seemingly chokes on backticks, whether escaped on not.

ruleTester.run('no-unneeded-backticks', rules['no-unneeded-backticks'], {
	valid: [
		{
			code: "var str = 'abc';",
		},
		{
			code: 'var str = "abc";',
		},
		{
			code: `
				This is a sentence.
				This is another.
			`,
		},
		{
			code: `This is a \${myVar}`,
		},
	],
	invalid: [
		{
			code: 'var str = \\`abc\\`;',
			errors: [{ messageId: 'noUnnededBackticks' }],
			output: "var str = 'abc';",
		},
		{
			code: "var str = `abc 'def' ghi`;",
			errors: [{ messageId: 'noUnnededBackticks' }],
			output: 'var str = \'abc "def" ghi\';',
		},
	],
});

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system labels Dec 29, 2022
Copy link
Member

@netroy netroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.
Can we please also add another rule to enforce backticks when there is a ${...} token present?

@ivov ivov merged commit d9b98fc into master Dec 29, 2022
@ivov ivov deleted the lint-for-no-unneeded-backticks branch December 29, 2022 11:20
@n8n-assistant n8n-assistant bot added the Upcoming Release Will be part of the upcoming release label Dec 29, 2022
MiloradFilipovic added a commit that referenced this pull request Dec 29, 2022
* master:
  ci: Fix linting on builds (no-changelog) (#5062)
  refactor: Lint for no interpolation in regular string (#5060) (no-changelog)
  ci: Fix lint for build (no-changelog) (#5059)
  perf: Prevent oclif from loading ts-node and typescript (#5047) (no-changelog)
  fix(editor): Make node title non-editable in executions view (#5046)
  refactor: Lint for no unneeded backticks (#5057) (no-changelog)
  fix(core): Fix full manual execution for error trigger as starter of 2+ node workflow (#5055)
  fix(editor): Support tabbing away from inline expression editor (#5056)
  refactor(editor): Usage and plans page on Desktop (#5051)
  📚 Update CHANGELOG.md and main package.json to 0.209.4
  🔖 Release [email protected]
  ⬆️ Set [email protected] on n8n
  🔖 Release [email protected]
  fix(editor): Usage and plans page on Desktop (#5045)
  feat(editor): Switch to expression on `=` input (#5044)
  fix(editor): Fix trigger node type identification on add to canvas (#5043)
@janober
Copy link
Member

janober commented Jan 5, 2023

Got released with [email protected]

@janober janober removed the Upcoming Release Will be part of the upcoming release label Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants