Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c95404d

Browse files
committed
chore(plugin-typescript): consistent formatting
1 parent 4a6d5f7 commit c95404d

File tree

74 files changed

+4767
-4773
lines changed

Some content is hidden

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

74 files changed

+4767
-4773
lines changed

packages/eslint-plugin-typescript/.prettierrc.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

packages/eslint-plugin-typescript/docs/rules/camelcase.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function foo({ no_camelcased = 'default value' }) {
6868
}
6969

7070
var obj = {
71-
my_pref: 1,
71+
my_pref: 1
7272
};
7373

7474
var { category_id = 1 } = query;
@@ -125,7 +125,7 @@ Examples of **correct** code for this rule with the `{ "properties": "never" }`
125125
/*eslint typescript/camelcase: ["error", {properties: "never"}]*/
126126

127127
var obj = {
128-
my_pref: 1,
128+
my_pref: 1
129129
};
130130
```
131131

packages/eslint-plugin-typescript/docs/rules/no-extraneous-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const StaticOnly = {
4242
version: 42,
4343
hello() {
4444
console.log('Hello, world!');
45-
},
45+
}
4646
};
4747
```
4848

packages/eslint-plugin-typescript/docs/rules/no-this-alias.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ You can pass an object option:
4545
'error',
4646
{
4747
allowDestructuring: true, // Allow `const { props, state } = this`; false by default
48-
allowedNames: ['self'], // Allow `const self = this`; `[]` by default
49-
},
50-
],
48+
allowedNames: ['self'] // Allow `const self = this`; `[]` by default
49+
}
50+
]
5151
}
5252
```
5353

packages/eslint-plugin-typescript/lib/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ module.exports = {
2020
rules: requireIndex(path.join(__dirname, 'rules')),
2121
configs: {
2222
// eslint-disable-next-line node/no-unpublished-require
23-
recommended: require('./configs/recommended'),
24-
},
23+
recommended: require('./configs/recommended')
24+
}
2525
};

packages/eslint-plugin-typescript/lib/rules/adjacent-overload-signatures.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ module.exports = {
1818
category: 'TypeScript',
1919
extraDescription: [util.tslintRule('adjacent-overload-signatures')],
2020
url: util.metaDocsUrl('adjacent-overload-signatures'),
21-
recommended: 'error',
21+
recommended: 'error'
2222
},
2323
schema: [],
2424
messages: {
25-
adjacentSignature: "All '{{name}}' signatures should be adjacent.",
26-
},
25+
adjacentSignature: "All '{{name}}' signatures should be adjacent."
26+
}
2727
},
2828

2929
create(context) {
@@ -99,8 +99,8 @@ module.exports = {
9999
node: member,
100100
messageId: 'adjacentSignature',
101101
data: {
102-
name,
103-
},
102+
name
103+
}
104104
});
105105
} else if (name && index === -1) {
106106
seen.push(name);
@@ -119,7 +119,7 @@ module.exports = {
119119
TSTypeLiteral: checkBodyForOverloadMethods,
120120
TSInterfaceBody: checkBodyForOverloadMethods,
121121
ClassBody: checkBodyForOverloadMethods,
122-
Program: checkBodyForOverloadMethods,
122+
Program: checkBodyForOverloadMethods
123123
};
124-
},
124+
}
125125
};

packages/eslint-plugin-typescript/lib/rules/array-type.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ module.exports = {
8888
extraDescription: [util.tslintRule('array-type')],
8989
category: 'TypeScript',
9090
url: util.metaDocsUrl('array-type'),
91-
recommended: 'error',
91+
recommended: 'error'
9292
},
9393
fixable: 'code',
9494
messages: {
@@ -99,13 +99,13 @@ module.exports = {
9999
errorStringArray:
100100
"Array type using 'Array<{{type}}>' is forbidden. Use '{{type}}[]' instead.",
101101
errorStringArraySimple:
102-
"Array type using 'Array<{{type}}>' is forbidden for simple types. Use '{{type}}[]' instead.",
102+
"Array type using 'Array<{{type}}>' is forbidden for simple types. Use '{{type}}[]' instead."
103103
},
104104
schema: [
105105
{
106-
enum: ['array', 'generic', 'array-simple'],
107-
},
108-
],
106+
enum: ['array', 'generic', 'array-simple']
107+
}
108+
]
109109
},
110110
create(context) {
111111
const option = util.applyDefault(defaultOptions, context.options)[0];
@@ -163,13 +163,13 @@ module.exports = {
163163
node,
164164
messageId,
165165
data: {
166-
type: getMessageType(node.elementType),
166+
type: getMessageType(node.elementType)
167167
},
168168
fix(fixer) {
169169
const startText = requireWhitespaceBefore(node);
170170
const toFix = [
171171
fixer.replaceTextRange([node.range[1] - 2, node.range[1]], '>'),
172-
fixer.insertTextBefore(node, `${startText ? ' ' : ''}Array<`),
172+
fixer.insertTextBefore(node, `${startText ? ' ' : ''}Array<`)
173173
];
174174

175175
if (node.elementType.type === 'TSParenthesizedType') {
@@ -182,7 +182,7 @@ module.exports = {
182182
}
183183

184184
return toFix;
185-
},
185+
}
186186
});
187187
},
188188
TSTypeReference(node) {
@@ -204,11 +204,11 @@ module.exports = {
204204
node,
205205
messageId,
206206
data: {
207-
type: 'any',
207+
type: 'any'
208208
},
209209
fix(fixer) {
210210
return fixer.replaceText(node, 'any[]');
211-
},
211+
}
212212
});
213213
return;
214214
}
@@ -227,7 +227,7 @@ module.exports = {
227227
node,
228228
messageId,
229229
data: {
230-
type: getMessageType(type),
230+
type: getMessageType(type)
231231
},
232232
fix(fixer) {
233233
return [
@@ -238,11 +238,11 @@ module.exports = {
238238
fixer.replaceTextRange(
239239
[type.range[1], node.range[1]],
240240
parens ? ')[]' : '[]'
241-
),
241+
)
242242
];
243-
},
243+
}
244244
});
245-
},
245+
}
246246
};
247-
},
247+
}
248248
};

packages/eslint-plugin-typescript/lib/rules/ban-types.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,26 @@ const defaultOptions = [
1515
types: {
1616
String: {
1717
message: 'Use string instead',
18-
fixWith: 'string',
18+
fixWith: 'string'
1919
},
2020
Boolean: {
2121
message: 'Use boolean instead',
22-
fixWith: 'boolean',
22+
fixWith: 'boolean'
2323
},
2424
Number: {
2525
message: 'Use number instead',
26-
fixWith: 'number',
26+
fixWith: 'number'
2727
},
2828
Object: {
2929
message: 'Use Record<string, any> instead',
30-
fixWith: 'Record<string, any>',
30+
fixWith: 'Record<string, any>'
3131
},
3232
Symbol: {
3333
message: 'Use symbol instead',
34-
fixWith: 'symbol',
35-
},
36-
},
37-
},
34+
fixWith: 'symbol'
35+
}
36+
}
37+
}
3838
];
3939

4040
module.exports = {
@@ -45,11 +45,11 @@ module.exports = {
4545
extraDescription: [util.tslintRule('ban-types')],
4646
category: 'TypeScript',
4747
url: util.metaDocsUrl('ban-types'),
48-
recommended: 'error',
48+
recommended: 'error'
4949
},
5050
fixable: 'code',
5151
messages: {
52-
bannedTypeMessage: "Don't use '{{name}}' as a type.{{customMessage}}",
52+
bannedTypeMessage: "Don't use '{{name}}' as a type.{{customMessage}}"
5353
},
5454
schema: [
5555
{
@@ -65,17 +65,17 @@ module.exports = {
6565
type: 'object',
6666
properties: {
6767
message: { type: 'string' },
68-
fixWith: { type: 'string' },
68+
fixWith: { type: 'string' }
6969
},
70-
additionalProperties: false,
71-
},
72-
],
73-
},
74-
},
70+
additionalProperties: false
71+
}
72+
]
73+
}
74+
}
7575
},
76-
additionalProperties: false,
77-
},
78-
],
76+
additionalProperties: false
77+
}
78+
]
7979
},
8080

8181
create(context) {
@@ -110,14 +110,14 @@ module.exports = {
110110
messageId: 'bannedTypeMessage',
111111
data: {
112112
name: node.name,
113-
customMessage,
113+
customMessage
114114
},
115115
fix:
116-
fixWith !== null && (fixer => fixer.replaceText(node, fixWith)),
116+
fixWith !== null && (fixer => fixer.replaceText(node, fixWith))
117117
});
118118
}
119119
}
120-
},
120+
}
121121
};
122-
},
122+
}
123123
};

packages/eslint-plugin-typescript/lib/rules/camelcase.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ const defaultOptions = [
1414
{
1515
allow: ['^UNSAFE_'],
1616
ignoreDestructuring: false,
17-
properties: 'never',
18-
},
17+
properties: 'never'
18+
}
1919
];
2020

2121
/* eslint-disable eslint-plugin/require-meta-type */
@@ -24,8 +24,8 @@ module.exports = {
2424
docs: {
2525
description: 'Enforce camelCase naming convention',
2626
url: util.metaDocsUrl('ban-types'),
27-
recommended: 'error',
28-
},
27+
recommended: 'error'
28+
}
2929
}),
3030

3131
create(context) {
@@ -34,7 +34,7 @@ module.exports = {
3434
'TSPropertySignature',
3535
'ClassProperty',
3636
'TSParameterProperty',
37-
'TSAbstractClassProperty',
37+
'TSAbstractClassProperty'
3838
];
3939

4040
const options = util.applyDefault(defaultOptions, context.options)[0];
@@ -105,7 +105,7 @@ module.exports = {
105105
context.report({
106106
node,
107107
messageId: 'notCamelCase',
108-
data: { name: node.name },
108+
data: { name: node.name }
109109
});
110110
}
111111

@@ -115,7 +115,7 @@ module.exports = {
115115
// Let the base rule deal with the rest
116116
// eslint-disable-next-line new-cap
117117
rules.Identifier(node);
118-
},
118+
}
119119
};
120-
},
120+
}
121121
};

packages/eslint-plugin-typescript/lib/rules/class-name-casing.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ module.exports = {
1919
extraDescription: [util.tslintRule('class-name')],
2020
category: 'Best Practices',
2121
url: util.metaDocsUrl('class-name-casing'),
22-
recommended: 'error',
22+
recommended: 'error'
2323
},
24-
schema: [],
24+
schema: []
2525
},
2626

2727
create(context) {
@@ -71,8 +71,8 @@ module.exports = {
7171
message: "{{friendlyName}} '{{name}}' must be PascalCased.",
7272
data: {
7373
friendlyName,
74-
name: resolvedId.name,
75-
},
74+
name: resolvedId.name
75+
}
7676
});
7777
}
7878

@@ -95,7 +95,7 @@ module.exports = {
9595
if (id && !node.init.id && !isPascalCase(id.name)) {
9696
report(node.init, id);
9797
}
98-
},
98+
}
9999
};
100-
},
100+
}
101101
};

0 commit comments

Comments
 (0)