eslint-config-gristow 2.0.5 → 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +18 -21
- package/package.json +1 -1
- package/rules/shared-rules.cjs +66 -5
- package/rules/svelte-rules.cjs +1 -2
- package/test-ts-export.ts +2 -0
- package/test.ts +20 -1
package/.vscode/settings.json
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"prettier.disableLanguages": ["javascript", "javascriptreact", "typescript"],
|
|
21
|
-
"eslint.validate": ["javascript", "javascriptreact", "typescript", "svelte"],
|
|
22
|
-
"eslint.probe": ["javascript", "typescript", "html", "svelte", "markdown"]
|
|
2
|
+
"[javascript]": {
|
|
3
|
+
"editor.codeActionsOnSave": {
|
|
4
|
+
"source.fixAll.eslint": true
|
|
5
|
+
}
|
|
6
|
+
},
|
|
7
|
+
"[typescript]": {
|
|
8
|
+
"editor.codeActionsOnSave": {
|
|
9
|
+
"source.fixAll.eslint": true
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"eslint.validate": ["javascript", "typescript", "svelte"],
|
|
13
|
+
"eslint.probe": ["javascript", "typescript", "html", "svelte", "markdown"],
|
|
14
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
15
|
+
"editor.formatOnSave": true,
|
|
16
|
+
"typescript.tsdk": "node_modules/typescript/lib",
|
|
17
|
+
"prettier.disableLanguages": ["javascript", "javascriptreact", "typescript"],
|
|
18
|
+
"editor.tabSize": 2,
|
|
19
|
+
"editor.insertSpaces": true
|
|
23
20
|
}
|
package/package.json
CHANGED
package/rules/shared-rules.cjs
CHANGED
|
@@ -83,9 +83,70 @@ module.exports = {
|
|
|
83
83
|
'implicit-arrow-linebreak': 'off',
|
|
84
84
|
'function-paren-newline': 'off',
|
|
85
85
|
// Snake case often comes in via external libraries
|
|
86
|
-
camelcase: ['error', {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}]
|
|
86
|
+
// camelcase: ['error', {
|
|
87
|
+
// properties: 'always',
|
|
88
|
+
// ignoreDestructuring: true,
|
|
89
|
+
// ignoreImports: true,
|
|
90
|
+
// }],
|
|
91
|
+
camelcase: 'off',
|
|
92
|
+
'@typescript-eslint/naming-convention': [
|
|
93
|
+
'error',
|
|
94
|
+
// By default, all should be camelCase
|
|
95
|
+
{
|
|
96
|
+
selector: 'default',
|
|
97
|
+
format: ['camelCase'],
|
|
98
|
+
},
|
|
99
|
+
// But, when we're destructuring, allow whatever it was:
|
|
100
|
+
{
|
|
101
|
+
selector: 'variable',
|
|
102
|
+
modifiers: ['destructured'],
|
|
103
|
+
format: null,
|
|
104
|
+
},
|
|
105
|
+
// And, if the property requires quotes, allow anything:
|
|
106
|
+
{
|
|
107
|
+
selector: [
|
|
108
|
+
'classProperty',
|
|
109
|
+
'objectLiteralProperty',
|
|
110
|
+
'typeProperty',
|
|
111
|
+
'classMethod',
|
|
112
|
+
'objectLiteralMethod',
|
|
113
|
+
'typeMethod',
|
|
114
|
+
'accessor',
|
|
115
|
+
'enumMember',
|
|
116
|
+
],
|
|
117
|
+
format: null,
|
|
118
|
+
modifiers: ['requiresQuotes'],
|
|
119
|
+
},
|
|
120
|
+
// But require variables to be in camelCase or UPPER_SNAKE
|
|
121
|
+
{
|
|
122
|
+
selector: 'variable',
|
|
123
|
+
format: ['camelCase', 'UPPER_CASE'],
|
|
124
|
+
},
|
|
125
|
+
// Allow leading underscores in function params
|
|
126
|
+
{
|
|
127
|
+
selector: 'parameter',
|
|
128
|
+
format: ['camelCase'],
|
|
129
|
+
leadingUnderscore: 'allow',
|
|
130
|
+
},
|
|
131
|
+
// Allow leading underscores in class private members
|
|
132
|
+
{
|
|
133
|
+
selector: 'memberLike',
|
|
134
|
+
modifiers: ['private'],
|
|
135
|
+
format: ['camelCase'],
|
|
136
|
+
leadingUnderscore: 'allow',
|
|
137
|
+
},
|
|
138
|
+
// And allow snake_case in object literals -- which simplifies
|
|
139
|
+
// our interaction with external libraries where options objects
|
|
140
|
+
// often require these.
|
|
141
|
+
{
|
|
142
|
+
selector: 'objectLiteralProperty',
|
|
143
|
+
format: ['camelCase', 'snake_case'],
|
|
144
|
+
},
|
|
145
|
+
// Make sure types and interfaces are in PascalCase. (Also applies
|
|
146
|
+
// to classes.)
|
|
147
|
+
{
|
|
148
|
+
selector: 'typeLike',
|
|
149
|
+
format: ['PascalCase'],
|
|
150
|
+
},
|
|
151
|
+
],
|
|
91
152
|
};
|
package/rules/svelte-rules.cjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
// Must disable to make 2-way data binding possible
|
|
3
3
|
'import/no-mutable-exports': 'off',
|
|
4
|
-
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
|
|
5
4
|
'no-labels': 'off',
|
|
6
5
|
'no-restricted-syntax': 'off',
|
|
7
6
|
// In svelte we often have to init an export ot undefined to mark it as an optional
|
|
@@ -10,4 +9,4 @@ module.exports = {
|
|
|
10
9
|
// Svelte checking will handle verifying resolved imports, and eslint is unfortunately
|
|
11
10
|
// unaware of vite paths:
|
|
12
11
|
'import/no-unresolved': 'off',
|
|
13
|
-
};
|
|
12
|
+
};
|
package/test-ts-export.ts
CHANGED
package/test.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { greetJS } from './test-js-export';
|
|
2
|
-
import { greet } from './test-ts-export';
|
|
2
|
+
import { greet, snake_case_import } from './test-ts-export';
|
|
3
3
|
|
|
4
4
|
greetJS('Johnny', 'Appleseed');
|
|
5
5
|
greet('Jenny', 'Applesseed');
|
|
@@ -25,4 +25,23 @@ function addOne(n) {
|
|
|
25
25
|
return n + 1;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
// error because not PascalCase
|
|
29
|
+
export class myClassName {}
|
|
30
|
+
|
|
31
|
+
const SNAKE_CASE_VARIABLE = 'snake case variable';
|
|
32
|
+
console.log(SNAKE_CASE_VARIABLE);
|
|
33
|
+
|
|
34
|
+
const this_is_a_problem = 'snake case variable';
|
|
35
|
+
console.log(this_is_a_problem);
|
|
36
|
+
|
|
37
|
+
console.log(snake_case_import);
|
|
38
|
+
|
|
39
|
+
const coordinates = {
|
|
40
|
+
x_top: 0,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const { x_top } = coordinates;
|
|
44
|
+
|
|
28
45
|
throw 'hello';
|
|
46
|
+
|
|
47
|
+
console.log('unreachable code error!');
|