TWNTY-3825 - ESLint rule: const naming (#4171)
* ESLint rule: const naming Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: KlingerMatheus <klinger.matheus@gitstart.dev> * Refactor according to review Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: KlingerMatheus <klinger.matheus@gitstart.dev> * refactor: Reverts changes on `twenty-server` Co-authored-by: KlingerMatheus <klinger.matheus@gitstart.dev> Co-authored-by: v1b3m <vibenjamin6@gmail.com> --------- Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com> Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: KlingerMatheus <klinger.matheus@gitstart.dev>
This commit is contained in:
committed by
GitHub
parent
a108d36040
commit
f543191552
25
tools/eslint-rules/rules/max-consts-per-file.spec.ts
Normal file
25
tools/eslint-rules/rules/max-consts-per-file.spec.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { TSESLint } from '@typescript-eslint/utils';
|
||||
|
||||
import { rule, RULE_NAME } from './max-consts-per-file';
|
||||
|
||||
const max = 1;
|
||||
|
||||
const ruleTester = new TSESLint.RuleTester({
|
||||
parser: require.resolve('@typescript-eslint/parser'),
|
||||
});
|
||||
|
||||
ruleTester.run(RULE_NAME, rule, {
|
||||
valid: [
|
||||
{
|
||||
code: 'const A = 1;',
|
||||
options: [{ max }],
|
||||
},
|
||||
],
|
||||
invalid: [
|
||||
{
|
||||
code: 'const NAME_A = 1;\nconst NAME_B = 2;',
|
||||
options: [{ max }],
|
||||
errors: [{ messageId: 'tooManyConstants', data: { max } }],
|
||||
},
|
||||
],
|
||||
});
|
||||
Reference in New Issue
Block a user