eslint-config-gristow 2.0.10 → 2.0.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-gristow",
3
- "version": "2.0.10",
3
+ "version": "2.0.12",
4
4
  "description": "Eslint settings for Greg Ristow",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -14,6 +14,7 @@
14
14
  "@typescript-eslint/parser": "^5.59.5",
15
15
  "eslint": "^8.40.0",
16
16
  "eslint-config-airbnb": "^19.0.4",
17
+ "eslint-config-airbnb-base": "^15.0.0",
17
18
  "eslint-config-airbnb-typescript": "^17.0.0",
18
19
  "eslint-config-prettier": "^8.5.0",
19
20
  "eslint-import-resolver-typescript": "^3.5.5",
@@ -0,0 +1,67 @@
1
+ module.exports = {
2
+ '@typescript-eslint/naming-convention': [
3
+ 'error',
4
+ // By default, all should be camelCase
5
+ {
6
+ selector: 'default',
7
+ format: ['camelCase'],
8
+ },
9
+ // Or, in the case of class names, type names, and interfaces, UpperCamelCase
10
+ // Make sure types and interfaces are in PascalCase. (Also applies
11
+ // to classes.)
12
+ {
13
+ selector: 'typeLike',
14
+ format: ['PascalCase'],
15
+ },
16
+ // But, when we're destructuring, allow whatever it was:
17
+ {
18
+ selector: 'variable',
19
+ modifiers: ['destructured'],
20
+ format: null,
21
+ },
22
+ // And, if the property requires quotes, allow anything:
23
+ {
24
+ selector: [
25
+ 'classProperty',
26
+ 'objectLiteralProperty',
27
+ 'typeProperty',
28
+ 'classMethod',
29
+ 'objectLiteralMethod',
30
+ 'typeMethod',
31
+ 'accessor',
32
+ 'enumMember',
33
+ ],
34
+ format: null,
35
+ modifiers: ['requiresQuotes'],
36
+ },
37
+ // But require variables to be in camelCase or UPPER_SNAKE
38
+ {
39
+ selector: 'variable',
40
+ format: ['camelCase', 'UPPER_CASE'],
41
+ },
42
+ // Allow leading underscores in function params
43
+ {
44
+ selector: 'parameter',
45
+ format: ['camelCase'],
46
+ leadingUnderscore: 'allow',
47
+ },
48
+ // Allow leading underscores in class private members
49
+ {
50
+ selector: 'memberLike',
51
+ modifiers: ['private'],
52
+ format: ['camelCase'],
53
+ leadingUnderscore: 'allow',
54
+ },
55
+ // And allow snake_case in object literals -- which simplifies
56
+ // our interaction with external libraries where options objects
57
+ // often require these.
58
+ {
59
+ selector: 'objectLiteralProperty',
60
+ filter: {
61
+ regex: '^[a-zA-Z]+(_[a-zA-Z\\d]+)*$',
62
+ match: true,
63
+ },
64
+ format: null,
65
+ },
66
+ ],
67
+ };
@@ -1,3 +1,5 @@
1
+ const namingConvention = require('./naming-convention.cjs');
2
+
1
3
  /**
2
4
  * These rules are shared by both .js and .ts
3
5
  */
@@ -11,6 +13,10 @@ module.exports = {
11
13
  'default-param-last': 'off',
12
14
  '@typescript-eslint/default-param-last': 'error',
13
15
 
16
+ // Note: you must disable the base rule as it can report incorrect errors
17
+ 'no-empty-function': 'off',
18
+ '@typescript-eslint/no-empty-function': 'error',
19
+
14
20
  'no-unreachable': 'error',
15
21
  'no-use-before-define': ['error', { functions: false }],
16
22
  // '@-define': ['error', { functions: false }],
@@ -90,68 +96,5 @@ module.exports = {
90
96
  // ignoreImports: true,
91
97
  // }],
92
98
  camelcase: 'off',
93
- '@typescript-eslint/naming-convention': [
94
- 'error',
95
- // By default, all should be camelCase
96
- {
97
- selector: 'default',
98
- format: ['camelCase'],
99
- },
100
- // But, when we're destructuring, allow whatever it was:
101
- {
102
- selector: 'variable',
103
- modifiers: ['destructured'],
104
- format: null,
105
- },
106
- // And, if the property requires quotes, allow anything:
107
- {
108
- selector: [
109
- 'classProperty',
110
- 'objectLiteralProperty',
111
- 'typeProperty',
112
- 'classMethod',
113
- 'objectLiteralMethod',
114
- 'typeMethod',
115
- 'accessor',
116
- 'enumMember',
117
- ],
118
- format: null,
119
- modifiers: ['requiresQuotes'],
120
- },
121
- // But require variables to be in camelCase or UPPER_SNAKE
122
- {
123
- selector: 'variable',
124
- format: ['camelCase', 'UPPER_CASE'],
125
- },
126
- // Allow leading underscores in function params
127
- {
128
- selector: 'parameter',
129
- format: ['camelCase'],
130
- leadingUnderscore: 'allow',
131
- },
132
- // Allow leading underscores in class private members
133
- {
134
- selector: 'memberLike',
135
- modifiers: ['private'],
136
- format: ['camelCase'],
137
- leadingUnderscore: 'allow',
138
- },
139
- // And allow snake_case in object literals -- which simplifies
140
- // our interaction with external libraries where options objects
141
- // often require these.
142
- {
143
- selector: 'objectLiteralProperty',
144
- filter: {
145
- regex: '^[a-zA-Z]+(_[a-zA-Z\\d]+)*$',
146
- match: true,
147
- },
148
- format: null,
149
- },
150
- // Make sure types and interfaces are in PascalCase. (Also applies
151
- // to classes.)
152
- {
153
- selector: 'typeLike',
154
- format: ['PascalCase'],
155
- },
156
- ],
99
+ ...namingConvention,
157
100
  };