Skip to content

Commit 990f552

Browse files
Loosened the naming-convention rule
1 parent f0be237 commit 990f552

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

lib/typescript-rules.js

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,49 @@ module.exports = {
203203
*
204204
* @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md
205205
*/
206-
"@typescript-eslint/naming-convention": "error",
206+
"@typescript-eslint/naming-convention": [
207+
"error",
208+
{
209+
selector: "default",
210+
filter: {
211+
regex: "\\W", // Ignore quoted properties (ones that contain non-word characters)
212+
match: false
213+
},
214+
format: ["camelCase"],
215+
leadingUnderscore: "allow",
216+
},
217+
218+
{
219+
selector: "variable",
220+
format: ["camelCase", "UPPER_CASE"],
221+
leadingUnderscore: "allow",
222+
},
223+
224+
{
225+
selector: "typeParameter",
226+
format: ["PascalCase"],
227+
prefix: ["T"], // Require generics to start with a T (e.g. T, TFoo, TBar)
228+
},
229+
230+
{
231+
selector: "enumMember",
232+
format: ["PascalCase"],
233+
},
234+
235+
{
236+
selector: "interface",
237+
format: ["PascalCase"],
238+
custom: {
239+
regex: "^I[A-Z]", // Interfaces should NOT begin with "I"
240+
match: false
241+
}
242+
},
243+
244+
{
245+
selector: "typeLike",
246+
format: ["PascalCase"],
247+
}
248+
],
207249

208250
/**
209251
* Disallow use of the Array constructor

0 commit comments

Comments
 (0)