Skip to content

Commit

Permalink
feat(eslint-plugin): remove no-extra-semi from recommended. add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
a-tarasyuk committed Dec 19, 2019
1 parent 10a5fc2 commit a36b70c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
2 changes: 0 additions & 2 deletions packages/eslint-plugin/src/configs/recommended.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
"@typescript-eslint/no-empty-function": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "warn",
"no-extra-semi": "off",
"@typescript-eslint/no-extra-semi": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin/src/rules/no-extra-semi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default util.createRule<Options, MessageIds>({
docs: {
description: 'Disallow unnecessary semicolons',
category: 'Possible Errors',
recommended: 'error',
recommended: false,
},
fixable: 'code',
schema: baseRule.meta.schema,
Expand Down
39 changes: 39 additions & 0 deletions packages/eslint-plugin/tests/rules/no-extra-semi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ ruleTester.run('no-extra-semi', rule, {
code: `
export class Foo {
public foo: number = 0;
}
`,
},
{
code: `
export class Foo {
public foo: number = 0; public bar: number = 1;
}
`,
},
Expand Down Expand Up @@ -317,5 +324,37 @@ class Foo {
},
],
},
{
code: `
class Foo {
public foo: number = 0;; public bar: number = 1;;
public baz: number = 1;;
}
`,
output: `
class Foo {
public foo: number = 0; public bar: number = 1;
public baz: number = 1;
}
`,
parserOptions: { ecmaVersion: 6 },
errors: [
{
messageId: 'unexpected',
line: 3,
column: 26,
},
{
messageId: 'unexpected',
line: 3,
column: 51,
},
{
messageId: 'unexpected',
line: 4,
column: 26,
},
],
},
],
});

0 comments on commit a36b70c

Please sign in to comment.