@cto.af/eslint-config 0.1.7 → 1.0.0

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/index.js CHANGED
@@ -19,7 +19,7 @@ module.exports = {
19
19
  },
20
20
  reportUnusedDisableDirectives: true,
21
21
  rules: {
22
- // Last updated 2022-02-10, v8.6.0
22
+ // Last updated 2022-01-12, v8.31.0
23
23
  // eslint-plugin-node 11.1.0
24
24
 
25
25
  // [Possible Problems](https://eslint.org/docs/rules/#possible-problems)
@@ -55,6 +55,7 @@ module.exports = {
55
55
  'no-irregular-whitespace': 'error',
56
56
  'no-loss-of-precision': 'error',
57
57
  'no-misleading-character-class': 'error',
58
+ 'no-new-native-nonconstructor': 'error',
58
59
  'no-new-symbol': 'error',
59
60
  'no-obj-calls': 'error',
60
61
  'no-promise-executor-return': 'error',
@@ -117,6 +118,7 @@ module.exports = {
117
118
  'id-length': 'off', // Not needed
118
119
  'id-match': 'off', // Not needed
119
120
  'init-declarations': 'error',
121
+ 'logical-assignment-operators': 'off', // No.
120
122
  'max-classes-per-file': 'off', // No.
121
123
  'max-depth': 'off', // No.
122
124
  'max-lines': 'off', // No.
@@ -139,6 +141,7 @@ module.exports = {
139
141
  'no-else-return': 'error',
140
142
  'no-empty': 'error',
141
143
  'no-empty-function': 'error',
144
+ 'no-empty-static-block': 'error',
142
145
  'no-eq-null': 'off', // I disagree with this one.
143
146
  'no-eval': 'error',
144
147
  'no-extend-native': 'error',
package/jsdoc.js CHANGED
@@ -75,6 +75,7 @@ module.exports = {
75
75
  'jsdoc/require-yields-check': 'error',
76
76
  'jsdoc/sort-tags': 'error',
77
77
  'jsdoc/tag-lines': 'error',
78
+ 'jsdoc/text-escaping': 'error',
78
79
  'jsdoc/valid-types': 'error',
79
80
  },
80
81
  }
package/modules.js CHANGED
@@ -22,7 +22,7 @@ module.exports = {
22
22
  'node/no-unsupported-features/es-syntax': [
23
23
  'error',
24
24
  {
25
- version: '>=12.19',
25
+ version: '>=14',
26
26
  ignores: ['modules'],
27
27
  },
28
28
  ],
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@cto.af/eslint-config",
3
- "version": "0.1.7",
3
+ "version": "1.0.0",
4
4
  "description": "hildjj's lint rules",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "eslint -c index.js *.js",
8
- "lint": "eslint . --ext js,cjs,mjs"
8
+ "lint": "eslint . --ext js,cjs,mjs",
9
+ "unused": "eslint-find-rules index.js -u && eslint-find-rules ava.js -u --no-core && eslint-find-rules jsdoc.js -u --no-core && eslint-find-rules ts.js -u --no-core"
9
10
  },
10
11
  "keywords": [
11
12
  "lint"
@@ -14,11 +15,23 @@
14
15
  "license": "MIT",
15
16
  "repository": "hildjj/ctoaf-eslint-config",
16
17
  "peerDependencies": {
18
+ "@typescript-eslint/eslint-plugin": "5.37.0",
19
+ "@typescript-eslint/parser": "5.37.0",
17
20
  "eslint-plugin-ava": "^13.2.0",
18
21
  "eslint-plugin-jsdoc": "^39.3.6",
19
- "eslint-plugin-node": "^11.1.0"
22
+ "eslint-plugin-node": "^11.1.0",
23
+ "typescript": "4.8.3"
20
24
  },
21
25
  "peerDependenciesMeta": {
26
+ "@typescript-eslint/eslint-plugin": {
27
+ "optional": true
28
+ },
29
+ "@typescript-eslint/parser": {
30
+ "optional": true
31
+ },
32
+ "typescript": {
33
+ "optional": true
34
+ },
22
35
  "eslint-plugin-ava": {
23
36
  "optional": true
24
37
  },
@@ -27,14 +40,17 @@
27
40
  }
28
41
  },
29
42
  "devDependencies": {
30
- "eslint": "^8.23.1",
43
+ "@typescript-eslint/eslint-plugin": "5.48.1",
44
+ "@typescript-eslint/parser": "5.48.1",
45
+ "eslint": "^8.31.0",
31
46
  "eslint-find-rules": "4.1.0",
32
47
  "eslint-plugin-ava": "^13.2.0",
33
48
  "eslint-plugin-hildjj": "link:rules",
34
- "eslint-plugin-jsdoc": "^39.3.6",
35
- "eslint-plugin-node": "^11.1.0"
49
+ "eslint-plugin-jsdoc": "^39.6.4",
50
+ "eslint-plugin-node": "^11.1.0",
51
+ "typescript": "4.9.4"
36
52
  },
37
53
  "engines": {
38
- "node": ">=12.19"
54
+ "node": ">=14"
39
55
  }
40
56
  }
package/ts.js ADDED
@@ -0,0 +1,205 @@
1
+ 'use strict'
2
+
3
+ // Last updated 2023-01-12
4
+ // "@typescript-eslint/eslint-plugin": "5.37.0"
5
+
6
+ module.exports = {
7
+ parser: '@typescript-eslint/parser',
8
+ parserOptions: {
9
+ sourceType: 'module',
10
+ },
11
+ plugins: ['@typescript-eslint'],
12
+ rules: {
13
+ // From plugin:@typescript-eslint/eslint-recommended
14
+ 'constructor-super': 'off',
15
+ 'getter-return': 'off',
16
+ 'no-const-assign': 'off',
17
+ 'no-dupe-args': 'off',
18
+ 'no-dupe-class-members': 'off',
19
+ 'no-dupe-keys': 'off',
20
+ 'no-func-assign': 'off',
21
+ 'no-import-assign': 'off',
22
+ 'no-new-symbol': 'off',
23
+ 'no-obj-calls': 'off',
24
+ 'no-redeclare': 'off',
25
+ 'no-setter-return': 'off',
26
+ 'no-this-before-super': 'off',
27
+ 'no-undef': 'off',
28
+ 'no-unreachable': 'off',
29
+ 'no-unsafe-negation': 'off',
30
+ 'no-var': 'error',
31
+ 'prefer-const': 'error',
32
+ 'prefer-rest-params': 'error',
33
+ 'prefer-spread': 'error',
34
+ 'valid-typeof': 'off',
35
+
36
+ // For all of these that have a non-plugin "off" to go with them,
37
+ // the typescript-eslint plugin provides a superset of the original
38
+ // rule.
39
+ '@typescript-eslint/adjacent-overload-signatures': 'error',
40
+ '@typescript-eslint/array-type': 'error',
41
+ '@typescript-eslint/await-thenable': 'off', // Can't config
42
+ '@typescript-eslint/ban-ts-comment': ['error', {
43
+ 'ts-expect-error': 'allow-with-description',
44
+ }],
45
+ '@typescript-eslint/ban-tslint-comment': 'error',
46
+ '@typescript-eslint/ban-types': 'off', // Not needed
47
+ 'brace-style': 'off',
48
+ '@typescript-eslint/brace-style': ['error', '1tbs', {
49
+ allowSingleLine: true,
50
+ }],
51
+ '@typescript-eslint/class-literal-property-style': ['error', 'getters'],
52
+ 'comma-dangle': 'off',
53
+ '@typescript-eslint/comma-dangle': [
54
+ 'error',
55
+ {
56
+ arrays: 'always-multiline',
57
+ objects: 'always-multiline',
58
+ imports: 'always-multiline',
59
+ exports: 'always-multiline',
60
+ functions: 'never',
61
+ enums: 'always-multiline',
62
+ generics: 'never',
63
+ tuples: 'always-multiline',
64
+ },
65
+ ],
66
+ 'comma-spacing': 'off',
67
+ '@typescript-eslint/comma-spacing': 'error',
68
+ 'default-param-last': 'off',
69
+ '@typescript-eslint/consistent-generic-constructors': [
70
+ 'error',
71
+ 'constructor',
72
+ ],
73
+ '@typescript-eslint/consistent-indexed-object-style': [
74
+ 'error',
75
+ 'index-signature',
76
+ ],
77
+ '@typescript-eslint/consistent-type-assertions': [
78
+ 'error',
79
+ {assertionStyle: 'as', objectLiteralTypeAssertions: 'allow'},
80
+ ],
81
+ '@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
82
+ '@typescript-eslint/consistent-type-exports': 'off', // Can't config
83
+ '@typescript-eslint/consistent-type-imports': 'off', // Can't do mixed
84
+ '@typescript-eslint/default-param-last': 'error',
85
+ '@typescript-eslint/dot-notation': 'off', // Can't config
86
+ '@typescript-eslint/explicit-function-return-type': 'error',
87
+ '@typescript-eslint/explicit-member-accessibility': 'error',
88
+ '@typescript-eslint/explicit-module-boundary-types': 'error',
89
+ 'func-call-spacing': 'off',
90
+ '@typescript-eslint/func-call-spacing': 'error',
91
+ '@typescript-eslint/indent': ['off', 2], // Broken, see https://github.com/typescript-eslint/typescript-eslint/issues/1824
92
+ '@typescript-eslint/init-declarations': 'error',
93
+ '@typescript-eslint/keyword-spacing': 'error',
94
+ '@typescript-eslint/lines-between-class-members': 'error',
95
+ '@typescript-eslint/member-delimiter-style': 'error',
96
+ '@typescript-eslint/member-ordering': 'error',
97
+ '@typescript-eslint/method-signature-style': ['error', 'method'],
98
+ '@typescript-eslint/naming-convention': 'off', // Too late
99
+ 'no-array-constructor': 'off',
100
+ '@typescript-eslint/no-array-constructor': 'error',
101
+ '@typescript-eslint/no-base-to-string': 'off', // Can't config
102
+ '@typescript-eslint/no-confusing-non-null-assertion': 'error',
103
+ '@typescript-eslint/no-confusing-void-expression': 'off', // Can't config
104
+ '@typescript-eslint/no-dupe-class-members': 'error',
105
+ '@typescript-eslint/no-duplicate-enum-values': 'error',
106
+ '@typescript-eslint/no-dynamic-delete': 'error',
107
+ 'no-empty-function': 'off',
108
+ '@typescript-eslint/no-empty-function': 'error',
109
+ '@typescript-eslint/no-empty-interface': 'error',
110
+ '@typescript-eslint/no-explicit-any': 'off', // Too hard
111
+ '@typescript-eslint/no-extra-non-null-assertion': 'error',
112
+ '@typescript-eslint/no-extra-parens': 'off', // Disagree
113
+ 'no-extra-semi': 'off',
114
+ '@typescript-eslint/no-extra-semi': 'error',
115
+ '@typescript-eslint/no-extraneous-class': 'error',
116
+ '@typescript-eslint/no-floating-promises': 'off', // Can't config
117
+ '@typescript-eslint/no-for-in-array': 'error',
118
+ '@typescript-eslint/no-implied-eval': 'off', // Can't config
119
+ '@typescript-eslint/no-inferrable-types': 'error',
120
+ '@typescript-eslint/no-invalid-this': 'error',
121
+ '@typescript-eslint/no-invalid-void-type': 'error',
122
+ 'no-loop-func': 'off',
123
+ '@typescript-eslint/no-loop-func': 'error',
124
+ '@typescript-eslint/no-loss-of-precision': 'error',
125
+ '@typescript-eslint/no-magic-numbers': 'off', // Too late
126
+ '@typescript-eslint/no-meaningless-void-operator': 'off', // Can't config
127
+ '@typescript-eslint/no-misused-new': 'error',
128
+ '@typescript-eslint/no-misused-promises': 'off', // Can't config
129
+ '@typescript-eslint/no-namespace': 'error',
130
+ '@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
131
+ '@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
132
+ '@typescript-eslint/no-non-null-assertion': 'error',
133
+ '@typescript-eslint/no-redeclare': 'error',
134
+ '@typescript-eslint/no-redundant-type-constituents': 'off', // Can't config
135
+ '@typescript-eslint/no-require-imports': 'error',
136
+ '@typescript-eslint/no-restricted-imports': 'off', // Not needed
137
+ '@typescript-eslint/no-shadow': 'error',
138
+ '@typescript-eslint/no-this-alias': 'error',
139
+ '@typescript-eslint/no-throw-literal': 'off', // Can't config
140
+ '@typescript-eslint/no-type-alias': 'off', // Not important
141
+ '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'off', // Can't config
142
+ '@typescript-eslint/no-unnecessary-condition': 'off', // Can't config
143
+ '@typescript-eslint/no-unnecessary-qualifier': 'off', // Can't config
144
+ '@typescript-eslint/no-unnecessary-type-arguments': 'off', // Can't config
145
+ '@typescript-eslint/no-unnecessary-type-assertion': 'off', // Can't config
146
+ '@typescript-eslint/no-unnecessary-type-constraint': 'error',
147
+ '@typescript-eslint/no-unsafe-argument': 'off', // Can't config
148
+ '@typescript-eslint/no-unsafe-assignment': 'off', // Can't config
149
+ '@typescript-eslint/no-unsafe-call': 'off', // Can't config
150
+ '@typescript-eslint/no-unsafe-declaration-merging': 'error',
151
+ '@typescript-eslint/no-unsafe-member-access': 'off', // Can't config
152
+ '@typescript-eslint/no-unsafe-return': 'off', // Can't config
153
+ '@typescript-eslint/no-unused-expressions': 'error',
154
+ 'no-unused-vars': 'off',
155
+ '@typescript-eslint/no-unused-vars': 'error',
156
+ '@typescript-eslint/no-use-before-define': 'error',
157
+ '@typescript-eslint/no-useless-constructor': 'error',
158
+ '@typescript-eslint/no-useless-empty-export': 'error',
159
+ '@typescript-eslint/no-var-requires': 'error',
160
+ '@typescript-eslint/non-nullable-type-assertion-style': 'off', // Can't config
161
+ 'object-curly-spacing': 'off',
162
+ '@typescript-eslint/object-curly-spacing': ['error', 'always'],
163
+ '@typescript-eslint/padding-line-between-statements': 'error',
164
+ '@typescript-eslint/parameter-properties': 'error',
165
+ '@typescript-eslint/prefer-as-const': 'error',
166
+ '@typescript-eslint/prefer-enum-initializers': 'error',
167
+ '@typescript-eslint/prefer-for-of': 'error',
168
+ '@typescript-eslint/prefer-function-type': 'error',
169
+ '@typescript-eslint/prefer-includes': 'off', // Can't config
170
+ '@typescript-eslint/prefer-literal-enum-member': 'error',
171
+ '@typescript-eslint/prefer-namespace-keyword': 'error',
172
+ '@typescript-eslint/prefer-nullish-coalescing': 'off', // Can't config
173
+ '@typescript-eslint/prefer-optional-chain': 'error',
174
+ '@typescript-eslint/prefer-readonly-parameter-types': 'off', // Can't config
175
+ '@typescript-eslint/prefer-readonly': 'off', // Can't config
176
+ '@typescript-eslint/prefer-reduce-type-parameter': 'off', // Can't config
177
+ '@typescript-eslint/prefer-regexp-exec': 'off', // Can't config
178
+ '@typescript-eslint/prefer-return-this-type': 'off', // Can't config
179
+ '@typescript-eslint/prefer-string-starts-ends-with': 'off', // Can't config
180
+ '@typescript-eslint/prefer-ts-expect-error': 'error',
181
+ '@typescript-eslint/promise-function-async': 'off', // Can't config
182
+ 'quotes': 'off',
183
+ '@typescript-eslint/quotes': ['error', 'single', {avoidEscape: true}],
184
+ '@typescript-eslint/require-array-sort-compare': 'off', // Can't config
185
+ '@typescript-eslint/require-await': 'off', // Can't config
186
+ '@typescript-eslint/restrict-plus-operands': 'off', // Can't config
187
+ '@typescript-eslint/restrict-template-expressions': 'off', // Can't config
188
+ '@typescript-eslint/return-await': 'off', // Can't config
189
+ 'semi': 'off',
190
+ '@typescript-eslint/semi': ['error', 'never'],
191
+ '@typescript-eslint/sort-type-constituents': 'error',
192
+ '@typescript-eslint/space-before-blocks': 'error',
193
+ 'space-before-function-paren': 'off',
194
+ '@typescript-eslint/space-before-function-paren': ['error', 'never'],
195
+ 'space-infix-ops': 'off',
196
+ '@typescript-eslint/space-infix-ops': ['error', {int32Hint: true}],
197
+ '@typescript-eslint/strict-boolean-expressions': 'off', // Can't config
198
+ '@typescript-eslint/switch-exhaustiveness-check': 'off', // Can't config
199
+ '@typescript-eslint/triple-slash-reference': 'error',
200
+ '@typescript-eslint/type-annotation-spacing': 'error',
201
+ '@typescript-eslint/typedef': 'error',
202
+ '@typescript-eslint/unbound-method': 'off', // Can't config
203
+ '@typescript-eslint/unified-signatures': 'off', // Too hard
204
+ },
205
+ }
package/typescript.js ADDED
@@ -0,0 +1,17 @@
1
+ 'use strict'
2
+ // Use this in typescript projects
3
+
4
+ // module.exports = {
5
+ // extends: '@cto.af/eslint-config/typescript'
6
+ // }
7
+
8
+ module.exports = {
9
+ overrides: [
10
+ {
11
+ files: ['*.ts'],
12
+ extends: [
13
+ './ts.js',
14
+ ],
15
+ },
16
+ ],
17
+ }