8000 chore: turn on plugin-test-formatting rule (#1822) · thomaschaaf/typescript-eslint@188b689 · GitHub
[go: up one dir, main page]

Skip to content

Commit 188b689

Browse files
authored
chore: turn on plugin-test-formatting rule (typescript-eslint#1822)
1 parent 9642d9d commit 188b689

File tree

93 files changed

+8819
-6610
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+8819
-6610
lines changed

.eslintrc.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ module.exports = {
174174
'@typescript-eslint/internal/no-typescript-estree-import': 'error',
175175
},
176176
},
177-
// rule source files
177+
// plugin rule source files
178178
{
179179
files: [
180180
'packages/eslint-plugin-internal/src/rules/**/*.ts',
@@ -187,6 +187,17 @@ module.exports = {
187187
'import/no-default-export': 'off',
188188
},
189189
},
190+
// plugin rule tests
191+
{
192+
files: [
193+
'packages/eslint-plugin-internal/tests/rules/**/*.test.ts',
194+
'packages/eslint-plugin-tslint/tests/rules/**/*.test.ts',
195+
'packages/eslint-plugin/tests/rules/**/*.test.ts',
196+
],
197+
rules: {
198+
'@typescript-eslint/internal/plugin-test-formatting': 'error',
199+
},
200+
},
190201
// tools and tests
191202
{
192203
files: ['**/tools/**/*.ts', '**/tests/**/*.ts'],

packages/eslint-plugin-internal/tests/rules/no-typescript-estree.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ const ruleTester = new RuleTester({
1010

1111
ruleTester.run('no-typescript-estree-import', rule, {
1212
valid: [
13-
'import { foo } from "@typescript-eslint/experimental-utils";',
14-
'import foo from "@typescript-eslint/experimental-utils";',
15-
'import * as foo from "@typescript-eslint/experimental-utils";',
13+
"import { foo } from '@typescript-eslint/experimental-utils';",
14+
"import foo from '@typescript-eslint/experimental-utils';",
15+
"import * as foo from '@typescript-eslint/experimental-utils';",
1616
],
1717
invalid: batchedSingleLineTests({
1818
code: `
19-
import { foo } from "@typescript-eslint/typescript-estree";
20-
import foo from "@typescript-eslint/typescript-estree";
21-
import * as foo from "@typescript-eslint/typescript-estree";
19+
import { foo } from '@typescript-eslint/typescript-estree';
20+
import foo from '@typescript-eslint/typescript-estree';
21+
import * as foo from '@typescript-eslint/typescript-estree';
2222
`,
2323
output: `
24-
import { foo } from "@typescript-eslint/experimental-utils";
25-
import foo from "@typescript-eslint/experimental-utils";
26-
import * as foo from "@typescript-eslint/experimental-utils";
24+
import { foo } from '@typescript-eslint/experimental-utils';
25+
import foo from '@typescript-eslint/experimental-utils';
26+
import * as foo from '@typescript-eslint/experimental-utils';
2727
`,
2828
errors: [
2929
{

packages/eslint-plugin-internal/tests/rules/plugin-test-formatting.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ const a = 1;
7171
${PARENT_INDENT}\``,
7272
wrap`noFormat\`const a = 1;\``,
7373
// sanity check suggestion validation
74+
// eslint-disable-next-line @typescript-eslint/internal/plugin-test-formatting
7475
`
7576
ruleTester.run({
7677
invalid: [

packages/eslint-plugin-internal/tests/rules/prefer-ast-types-enum.test.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,29 @@ const ruleTester = new RuleTester({
1414

1515
ruleTester.run('prefer-ast-types-enum', rule, {
1616
valid: [
17-
'node.type === "constructor"',
18-
'node.type === AST_NODE_TYPES.Literal',
19-
'node.type === AST_TOKEN_TYPES.Keyword',
20-
'node.type === 1',
17+
"node.type === 'constructor';",
18+
'node.type === AST_NODE_TYPES.Literal;',
19+
'node.type === AST_TOKEN_TYPES.Keyword;',
20+
'node.type === 1;',
2121
`
22-
enum MY_ENUM {
23-
Literal = 1
24-
}
22+
enum MY_ENUM {
23+
Literal = 1,
24+
}
2525
`,
2626
`
27-
enum AST_NODE_TYPES {
28-
Literal = 'Literal'
29-
}
27+
enum AST_NODE_TYPES {
28+
Literal = 'Literal',
29+
}
3030
`,
3131
],
3232
invalid: batchedSingleLineTests({
3333
code: `
34-
node.type === 'Literal'
35-
node.type === 'Keyword'
34+
node.type === 'Literal';
35+
node.type === 'Keyword';
3636
`,
3737
output: `
38-
node.type === AST_NODE_TYPES.Literal
39-
node.type === AST_TOKEN_TYPES.Keyword
38+
node.type === AST_NODE_TYPES.Literal;
39+
node.type === AST_TOKEN_TYPES.Keyword;
4040
`,
4141
errors: [
4242
{

0 commit comments

Comments
 (0)
0