eslint-config-seek 0.0.0-try-new-version-20250318131458 → 0.0.0-typescriptify-vitest-20251112023958

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.
@@ -0,0 +1,14 @@
1
+ const require_base = require('./base-BxFQUqDk.cjs');
2
+ let __vitest_eslint_plugin = require("@vitest/eslint-plugin");
3
+ __vitest_eslint_plugin = require_base.__toESM(__vitest_eslint_plugin);
4
+
5
+ //#region src/vitest/base.ts
6
+ var base_default$1 = [...require_base.base_default, { plugins: { vitest: __vitest_eslint_plugin.default } }];
7
+
8
+ //#endregion
9
+ Object.defineProperty(exports, 'base_default', {
10
+ enumerable: true,
11
+ get: function () {
12
+ return base_default$1;
13
+ }
14
+ });
@@ -0,0 +1,263 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+
23
+ //#endregion
24
+ const require_extensions = require('./extensions-vqCxaxgq.cjs');
25
+ let eslint_plugin_import_x = require("eslint-plugin-import-x");
26
+ eslint_plugin_import_x = __toESM(eslint_plugin_import_x);
27
+ let globals = require("globals");
28
+ globals = __toESM(globals);
29
+ let eslint_plugin_cypress = require("eslint-plugin-cypress");
30
+ eslint_plugin_cypress = __toESM(eslint_plugin_cypress);
31
+ let eslint_config_prettier = require("eslint-config-prettier");
32
+ eslint_config_prettier = __toESM(eslint_config_prettier);
33
+ let typescript_eslint = require("typescript-eslint");
34
+ typescript_eslint = __toESM(typescript_eslint);
35
+
36
+ //#region src/base/base.ts
37
+ const OFF = 0;
38
+ const WARN = 1;
39
+ const ERROR = 2;
40
+ const baseRules = {
41
+ "no-console": ERROR,
42
+ "no-unexpected-multiline": ERROR,
43
+ "block-scoped-var": ERROR,
44
+ "default-case": ERROR,
45
+ "dot-notation": ERROR,
46
+ eqeqeq: [
47
+ ERROR,
48
+ "always",
49
+ { null: "ignore" }
50
+ ],
51
+ "guard-for-in": ERROR,
52
+ "no-alert": ERROR,
53
+ "no-caller": ERROR,
54
+ "no-div-regex": ERROR,
55
+ "no-else-return": ERROR,
56
+ "no-eval": ERROR,
57
+ "no-extend-native": ERROR,
58
+ "no-extra-bind": ERROR,
59
+ "no-fallthrough": ERROR,
60
+ "no-floating-decimal": ERROR,
61
+ "no-implicit-coercion": ERROR,
62
+ "no-implied-eval": ERROR,
63
+ "no-iterator": ERROR,
64
+ "no-labels": ERROR,
65
+ "no-lone-blocks": ERROR,
66
+ "no-loop-func": ERROR,
67
+ "no-multi-str": ERROR,
68
+ "no-new-func": ERROR,
69
+ "no-new-wrappers": ERROR,
70
+ "no-new": ERROR,
71
+ "no-octal-escape": ERROR,
72
+ "no-param-reassign": ERROR,
73
+ "no-proto": ERROR,
74
+ "no-return-assign": ERROR,
75
+ "no-script-url": ERROR,
76
+ "no-self-compare": ERROR,
77
+ "no-sequences": ERROR,
78
+ "no-throw-literal": ERROR,
79
+ "no-useless-call": ERROR,
80
+ "no-void": ERROR,
81
+ radix: ERROR,
82
+ "vars-on-top": ERROR,
83
+ yoda: ERROR,
84
+ strict: [ERROR, "never"],
85
+ "no-label-var": ERROR,
86
+ "no-shadow": ERROR,
87
+ "no-undef-init": ERROR,
88
+ "no-unused-vars": [ERROR, {
89
+ argsIgnorePattern: "^_",
90
+ ignoreRestSiblings: true
91
+ }],
92
+ "handle-callback-err": ERROR,
93
+ "no-new-require": ERROR,
94
+ "no-path-concat": ERROR,
95
+ "no-process-exit": ERROR,
96
+ "no-restricted-modules": ERROR,
97
+ "no-restricted-syntax": [
98
+ ERROR,
99
+ {
100
+ selector: "MethodDefinition[kind = \"get\"]",
101
+ message: "Custom getters can cause confusion, particularly if they throw errors. Remove the `get` syntax to specify a regular method instead."
102
+ },
103
+ {
104
+ selector: "MethodDefinition[kind = \"set\"]",
105
+ message: "Custom setters can cause confusion, particularly if they throw errors. Remove the `set` syntax to specify a regular method instead."
106
+ },
107
+ {
108
+ selector: "Property[kind = \"get\"]",
109
+ message: "Custom getters can cause confusion, particularly if they throw errors. Remove the `get` syntax to specify a regular property instead."
110
+ },
111
+ {
112
+ selector: "Property[kind = \"set\"]",
113
+ message: "Custom setters can cause confusion, particularly if they throw errors. Remove the `set` syntax to specify a regular property instead."
114
+ }
115
+ ],
116
+ "no-sync": ERROR,
117
+ "linebreak-style": [ERROR, "unix"],
118
+ "new-cap": ERROR,
119
+ "no-lonely-if": ERROR,
120
+ "no-nested-ternary": ERROR,
121
+ "no-unneeded-ternary": ERROR,
122
+ "spaced-comment": [ERROR, "always"],
123
+ "no-var": ERROR,
124
+ "object-shorthand": ERROR,
125
+ "prefer-const": ERROR,
126
+ "prefer-spread": ERROR,
127
+ "prefer-template": ERROR,
128
+ "no-return-await": OFF
129
+ };
130
+ const eslintConfigPrettierOverrideRules = { curly: [ERROR, "all"] };
131
+ const allExtensions = [...require_extensions.js, ...require_extensions.ts];
132
+ const settings = { "import-x/resolver": {
133
+ typescript: true,
134
+ node: true
135
+ } };
136
+ var base_default = [
137
+ { plugins: {
138
+ cypress: eslint_plugin_cypress.default,
139
+ "@typescript-eslint": typescript_eslint.default.plugin
140
+ } },
141
+ eslint_plugin_import_x.default.flatConfigs.typescript,
142
+ {
143
+ rules: eslint_plugin_import_x.default.flatConfigs.errors.rules,
144
+ files: [`**/*.{${require_extensions.js}}`]
145
+ },
146
+ {
147
+ rules: eslint_plugin_import_x.default.flatConfigs.warnings.rules,
148
+ files: [`**/*.{${require_extensions.js}}`]
149
+ },
150
+ {
151
+ languageOptions: {
152
+ globals: { ...globals.default.node },
153
+ parserOptions: {
154
+ requireConfigFile: false,
155
+ ecmaVersion: "latest",
156
+ sourceType: "module"
157
+ }
158
+ },
159
+ settings,
160
+ rules: baseRules
161
+ },
162
+ eslint_config_prettier.default,
163
+ {
164
+ languageOptions: {
165
+ globals: { ...globals.default.node },
166
+ parserOptions: {
167
+ requireConfigFile: false,
168
+ ecmaVersion: "latest",
169
+ sourceType: "module"
170
+ }
171
+ },
172
+ settings,
173
+ rules: eslintConfigPrettierOverrideRules
174
+ },
175
+ ...[...typescript_eslint.default.configs.recommended, ...typescript_eslint.default.configs.stylistic].map((config) => ({
176
+ ...config,
177
+ files: [`**/*.{${require_extensions.ts}}`]
178
+ })),
179
+ {
180
+ files: [`**/*.{${require_extensions.ts}}`],
181
+ languageOptions: {
182
+ parser: typescript_eslint.default.parser,
183
+ parserOptions: {
184
+ projectService: true,
185
+ warnOnUnsupportedTypeScriptVersion: false
186
+ }
187
+ },
188
+ settings,
189
+ rules: {
190
+ "@typescript-eslint/array-type": [ERROR, { default: "array-simple" }],
191
+ "@typescript-eslint/consistent-type-definitions": OFF,
192
+ "@typescript-eslint/no-unused-expressions": ERROR,
193
+ "@typescript-eslint/no-unused-vars": [ERROR, {
194
+ argsIgnorePattern: "^_",
195
+ ignoreRestSiblings: true
196
+ }],
197
+ "@typescript-eslint/no-use-before-define": OFF,
198
+ "@typescript-eslint/no-non-null-assertion": OFF,
199
+ "@typescript-eslint/ban-ts-comment": OFF,
200
+ "@typescript-eslint/no-explicit-any": OFF,
201
+ "@typescript-eslint/explicit-function-return-type": OFF,
202
+ "@typescript-eslint/naming-convention": [
203
+ WARN,
204
+ {
205
+ selector: "typeLike",
206
+ format: ["PascalCase"],
207
+ leadingUnderscore: "allow"
208
+ },
209
+ {
210
+ selector: "enum",
211
+ format: null
212
+ }
213
+ ],
214
+ "@typescript-eslint/no-empty-function": OFF,
215
+ "@typescript-eslint/no-empty-interface": OFF,
216
+ "@typescript-eslint/no-inferrable-types": [ERROR, { ignoreParameters: true }],
217
+ "default-case": OFF,
218
+ "arrow-body-style": [ERROR, "as-needed"],
219
+ "no-shadow": OFF,
220
+ "@typescript-eslint/no-shadow": ERROR,
221
+ "@typescript-eslint/consistent-type-imports": [ERROR, { fixStyle: "inline-type-imports" }],
222
+ "@typescript-eslint/consistent-type-exports": [ERROR, { fixMixedExportsWithInlineTypeSpecifier: true }],
223
+ "@typescript-eslint/no-import-type-side-effects": ERROR,
224
+ "import-x/no-duplicates": [ERROR, { "prefer-inline": true }],
225
+ "import-x/export": ERROR
226
+ }
227
+ },
228
+ {
229
+ files: [`**/*.{${require_extensions.js}}`],
230
+ languageOptions: { globals: {} },
231
+ settings,
232
+ rules: {
233
+ "no-undef": ERROR,
234
+ "no-use-before-define": [ERROR, { functions: false }],
235
+ "no-unused-expressions": ERROR,
236
+ "import-x/no-unresolved": [ERROR, {
237
+ commonjs: true,
238
+ amd: true,
239
+ ignore: [".svg$", "^file?"]
240
+ }],
241
+ "import-x/no-duplicates": ERROR,
242
+ "import-x/export": ERROR
243
+ }
244
+ },
245
+ {
246
+ ...eslint_plugin_cypress.default.configs.recommended,
247
+ files: [`**/cypress/**/*.{${allExtensions}}`]
248
+ }
249
+ ];
250
+
251
+ //#endregion
252
+ Object.defineProperty(exports, '__toESM', {
253
+ enumerable: true,
254
+ get: function () {
255
+ return __toESM;
256
+ }
257
+ });
258
+ Object.defineProperty(exports, 'base_default', {
259
+ enumerable: true,
260
+ get: function () {
261
+ return base_default;
262
+ }
263
+ });
package/dist/base.cjs ADDED
@@ -0,0 +1,24 @@
1
+ const require_base = require('./base-BxFQUqDk.cjs');
2
+ const require_extensions = require('./extensions-vqCxaxgq.cjs');
3
+ let globals = require("globals");
4
+ globals = require_base.__toESM(globals);
5
+ let eslint_plugin_jest = require("eslint-plugin-jest");
6
+ eslint_plugin_jest = require_base.__toESM(eslint_plugin_jest);
7
+
8
+ //#region src/base.ts
9
+ const allExtensions = [...require_extensions.js, ...require_extensions.ts];
10
+ var base_default = [
11
+ ...require_base.base_default,
12
+ { plugins: { jest: eslint_plugin_jest.default } },
13
+ {
14
+ ...eslint_plugin_jest.default.configs["flat/recommended"],
15
+ files: [`**/__tests__/**/*.{${allExtensions}}`, `**/*.@(spec|test).{${allExtensions}}`]
16
+ },
17
+ {
18
+ files: [`**/__tests__/**/*.{${allExtensions}}`, `**/*.@(spec|test).{${allExtensions}}`],
19
+ languageOptions: { globals: { ...globals.default.jest } }
20
+ }
21
+ ];
22
+
23
+ //#endregion
24
+ module.exports = base_default;
@@ -0,0 +1,28 @@
1
+
2
+ //#region src/extensions.ts
3
+ const js = [
4
+ "js",
5
+ "cjs",
6
+ "mjs",
7
+ "jsx"
8
+ ];
9
+ const ts = [
10
+ "ts",
11
+ "cts",
12
+ "mts",
13
+ "tsx"
14
+ ];
15
+
16
+ //#endregion
17
+ Object.defineProperty(exports, 'js', {
18
+ enumerable: true,
19
+ get: function () {
20
+ return js;
21
+ }
22
+ });
23
+ Object.defineProperty(exports, 'ts', {
24
+ enumerable: true,
25
+ get: function () {
26
+ return ts;
27
+ }
28
+ });
@@ -0,0 +1,4 @@
1
+ const require_extensions = require('./extensions-vqCxaxgq.cjs');
2
+
3
+ exports.js = require_extensions.js;
4
+ exports.ts = require_extensions.ts;
package/dist/index.cjs ADDED
@@ -0,0 +1,9 @@
1
+ const require_base = require('./base-BxFQUqDk.cjs');
2
+ require('./extensions-vqCxaxgq.cjs');
3
+ const require_react = require('./react-Civ_tFVV.cjs');
4
+
5
+ //#region src/index.ts
6
+ var src_default = [...require_base.base_default, ...require_react.react_default];
7
+
8
+ //#endregion
9
+ module.exports = src_default;
@@ -0,0 +1,55 @@
1
+ const require_base = require('./base-BxFQUqDk.cjs');
2
+ let globals = require("globals");
3
+ globals = require_base.__toESM(globals);
4
+ let eslint_plugin_react = require("eslint-plugin-react");
5
+ eslint_plugin_react = require_base.__toESM(eslint_plugin_react);
6
+ let eslint_plugin_react_hooks = require("eslint-plugin-react-hooks");
7
+ eslint_plugin_react_hooks = require_base.__toESM(eslint_plugin_react_hooks);
8
+
9
+ //#region src/base/react.ts
10
+ const OFF = 0;
11
+ const ERROR = 2;
12
+ const reactRules = {
13
+ "react/prefer-es6-class": [ERROR, "always"],
14
+ "react/self-closing-comp": ERROR,
15
+ "react/jsx-pascal-case": ERROR,
16
+ "react-hooks/rules-of-hooks": ERROR,
17
+ "react-hooks/exhaustive-deps": ERROR,
18
+ "react/no-children-prop": ERROR,
19
+ "react/display-name": OFF,
20
+ "react/prop-types": OFF,
21
+ "react/jsx-curly-brace-presence": [ERROR, {
22
+ props: "never",
23
+ children: "ignore",
24
+ propElementValues: "always"
25
+ }]
26
+ };
27
+ var react_default = [
28
+ eslint_plugin_react.default.configs.flat.recommended,
29
+ eslint_plugin_react.default.configs.flat["jsx-runtime"],
30
+ {
31
+ plugins: {
32
+ react: eslint_plugin_react.default,
33
+ "react-hooks": eslint_plugin_react_hooks.default
34
+ },
35
+ languageOptions: { globals: globals.default.browser },
36
+ settings: { react: { version: "detect" } },
37
+ rules: reactRules
38
+ },
39
+ {
40
+ files: ["**/*.tsx"],
41
+ rules: { "@typescript-eslint/no-unused-vars": [ERROR, {
42
+ argsIgnorePattern: "^_",
43
+ ignoreRestSiblings: true,
44
+ varsIgnorePattern: "^React$"
45
+ }] }
46
+ }
47
+ ];
48
+
49
+ //#endregion
50
+ Object.defineProperty(exports, 'react_default', {
51
+ enumerable: true,
52
+ get: function () {
53
+ return react_default;
54
+ }
55
+ });
@@ -0,0 +1,5 @@
1
+ require('../base-BxFQUqDk.cjs');
2
+ require('../extensions-vqCxaxgq.cjs');
3
+ const require_base$1 = require('../base-BpxGJOXX.cjs');
4
+
5
+ module.exports = require_base$1.base_default;
@@ -0,0 +1,10 @@
1
+ require('../base-BxFQUqDk.cjs');
2
+ require('../extensions-vqCxaxgq.cjs');
3
+ const require_react = require('../react-Civ_tFVV.cjs');
4
+ const require_base$1 = require('../base-BpxGJOXX.cjs');
5
+
6
+ //#region src/vitest/index.ts
7
+ var vitest_default = [...require_base$1.base_default, ...require_react.react_default];
8
+
9
+ //#endregion
10
+ module.exports = vitest_default;
package/package.json CHANGED
@@ -1,13 +1,8 @@
1
1
  {
2
2
  "name": "eslint-config-seek",
3
- "version": "0.0.0-try-new-version-20250318131458",
3
+ "version": "0.0.0-typescriptify-vitest-20251112023958",
4
+ "type": "module",
4
5
  "description": "ESLint configuration used by SEEK",
5
- "main": "index.js",
6
- "files": [
7
- "index.js",
8
- "base.js",
9
- "extensions.js"
10
- ],
11
6
  "repository": {
12
7
  "type": "git",
13
8
  "url": "https://github.com/seek-oss/eslint-config-seek.git"
@@ -17,13 +12,26 @@
17
12
  "bugs": {
18
13
  "url": "https://github.com/seek-oss/eslint-config-seek/issues"
19
14
  },
15
+ "main": "./dist/index.cjs",
16
+ "exports": {
17
+ ".": "./dist/index.cjs",
18
+ "./base": "./dist/base.cjs",
19
+ "./extensions": "./dist/extensions.cjs",
20
+ "./vitest": "./dist/vitest/index.cjs",
21
+ "./vitest/base": "./dist/vitest/base.cjs",
22
+ "./package.json": "./package.json"
23
+ },
24
+ "files": [
25
+ "dist"
26
+ ],
20
27
  "homepage": "https://github.com/seek-oss/eslint-config-seek#readme",
21
28
  "dependencies": {
29
+ "@vitest/eslint-plugin": "^1.4.2",
22
30
  "eslint-config-prettier": "^10.0.0",
23
- "eslint-import-resolver-typescript": "^3.6.3",
24
- "eslint-plugin-cypress": "^4.0.0",
25
- "eslint-plugin-import-x": "https://pkg.pr.new/un-ts/eslint-plugin-import-x@251",
26
- "eslint-plugin-jest": "^28.8.0",
31
+ "eslint-import-resolver-typescript": "^4.0.0",
32
+ "eslint-plugin-cypress": "^5.0.0",
33
+ "eslint-plugin-import-x": "^4.9.0",
34
+ "eslint-plugin-jest": "^29.0.0",
27
35
  "eslint-plugin-react": "^7.35.0",
28
36
  "eslint-plugin-react-hooks": "^5.0.0",
29
37
  "globals": "^16.0.0",
@@ -32,9 +40,12 @@
32
40
  "devDependencies": {
33
41
  "@changesets/cli": "^2.27.7",
34
42
  "@changesets/get-github-info": "^0.6.0",
43
+ "@tsconfig/node22": "^22.0.2",
35
44
  "eslint": "^9.8.0",
45
+ "jiti": "^2.6.1",
36
46
  "prettier": "^3.3.3",
37
- "typescript": "~5.7.0"
47
+ "tsdown": "^0.16.3",
48
+ "typescript": "~5.9.0"
38
49
  },
39
50
  "peerDependencies": {
40
51
  "eslint": ">=9.9.1",
@@ -43,12 +54,16 @@
43
54
  "engines": {
44
55
  "node": ">=18.18.0"
45
56
  },
46
- "volta": {
47
- "node": "22.14.0"
48
- },
49
57
  "scripts": {
50
- "release": "changeset publish",
51
- "test": "eslint --config index.js . && eslint --config base.js .",
52
- "changeset-version": "changeset version && prettier --write ."
58
+ "lint": "pnpm run '/^lint:.*/'",
59
+ "format": "pnpm run '/^format:.*/'",
60
+ "format:eslint": "eslint --fix .",
61
+ "format:prettier": "prettier --write .",
62
+ "lint:eslint": "eslint .",
63
+ "lint:tsc": "tsc --noEmit",
64
+ "build": "tsdown",
65
+ "lint:prettier": "prettier --check .",
66
+ "version": "changeset version && prettier --write .",
67
+ "release": "changeset publish"
53
68
  }
54
69
  }
package/base.js DELETED
@@ -1,235 +0,0 @@
1
- const importX = require('eslint-plugin-import-x');
2
- const globals = require('globals');
3
- const jestPlugin = require('eslint-plugin-jest');
4
- const cypress = require('eslint-plugin-cypress/flat');
5
- const eslintConfigPrettier = require('eslint-config-prettier');
6
- const tseslint = require('typescript-eslint');
7
-
8
- const OFF = 0;
9
- const ERROR = 2;
10
-
11
- const baseRules = {
12
- // Possible Errors
13
- 'no-console': ERROR,
14
- 'no-unexpected-multiline': ERROR,
15
- 'block-scoped-var': ERROR,
16
- curly: [ERROR, 'all'],
17
- 'default-case': ERROR,
18
- 'dot-notation': ERROR,
19
- eqeqeq: [ERROR, 'always', { null: 'ignore' }],
20
- 'guard-for-in': ERROR,
21
- 'no-alert': ERROR,
22
- 'no-caller': ERROR,
23
- 'no-div-regex': ERROR,
24
- 'no-else-return': ERROR,
25
- 'no-eval': ERROR,
26
- 'no-extend-native': ERROR,
27
- 'no-extra-bind': ERROR,
28
- 'no-fallthrough': ERROR,
29
- 'no-floating-decimal': ERROR,
30
- 'no-implicit-coercion': ERROR,
31
- 'no-implied-eval': ERROR,
32
- 'no-iterator': ERROR,
33
- 'no-labels': ERROR,
34
- 'no-lone-blocks': ERROR,
35
- 'no-loop-func': ERROR,
36
- 'no-multi-str': ERROR,
37
- 'no-new-func': ERROR,
38
- 'no-new-wrappers': ERROR,
39
- 'no-new': ERROR,
40
- 'no-octal-escape': ERROR,
41
- 'no-param-reassign': ERROR,
42
- 'no-proto': ERROR,
43
- 'no-return-assign': ERROR,
44
- 'no-script-url': ERROR,
45
- 'no-self-compare': ERROR,
46
- 'no-sequences': ERROR,
47
- 'no-throw-literal': ERROR,
48
- 'no-useless-call': ERROR,
49
- 'no-void': ERROR,
50
- radix: ERROR,
51
- 'vars-on-top': ERROR,
52
- yoda: ERROR,
53
- strict: [ERROR, 'never'],
54
- 'no-label-var': ERROR,
55
- 'no-shadow': ERROR,
56
- 'no-undef-init': ERROR,
57
- 'no-unused-vars': [
58
- ERROR,
59
- { argsIgnorePattern: '^_', ignoreRestSiblings: true },
60
- ],
61
- 'handle-callback-err': ERROR,
62
- 'no-new-require': ERROR,
63
- 'no-path-concat': ERROR,
64
- 'no-process-exit': ERROR,
65
- 'no-restricted-modules': ERROR,
66
- 'no-sync': ERROR,
67
- 'linebreak-style': [ERROR, 'unix'],
68
- 'new-cap': ERROR,
69
- 'no-lonely-if': ERROR,
70
- 'no-nested-ternary': ERROR,
71
- 'no-unneeded-ternary': ERROR,
72
- 'spaced-comment': [ERROR, 'always'],
73
- 'no-var': ERROR,
74
- 'object-shorthand': ERROR,
75
- 'prefer-const': ERROR,
76
- 'prefer-spread': ERROR,
77
- 'prefer-template': ERROR,
78
- // Allow devs to choose between performance and richer stack traces
79
- // https://eslint.org/docs/rules/no-return-await#when-not-to-use-it
80
- // https://github.com/goldbergyoni/nodebestpractices/blob/master@%7B2022-01-01T00:00:00Z%7D/sections/errorhandling/returningpromises.md
81
- 'no-return-await': OFF,
82
- };
83
-
84
- const { js: jsExtensions, ts: tsExtensions } = require('./extensions');
85
- const allExtensions = [...jsExtensions, ...tsExtensions];
86
-
87
- const settings = {
88
- 'import-x/resolver': {
89
- typescript: true,
90
- node: true,
91
- },
92
- };
93
-
94
- module.exports = [
95
- {
96
- plugins: {
97
- jest: jestPlugin,
98
- cypress,
99
- '@typescript-eslint': tseslint.plugin,
100
- },
101
- },
102
- importX.flatConfigs.typescript,
103
- {
104
- rules: importX.flatConfigs.errors.rules,
105
- files: [`**/*.{${jsExtensions}}`],
106
- },
107
- {
108
- rules: importX.flatConfigs.warnings.rules,
109
- files: [`**/*.{${jsExtensions}}`],
110
- },
111
- {
112
- languageOptions: {
113
- globals: {
114
- ...globals.node,
115
- },
116
-
117
- parserOptions: {
118
- requireConfigFile: false,
119
- ecmaVersion: 'latest',
120
- sourceType: 'module',
121
- },
122
- },
123
- settings,
124
- rules: baseRules,
125
- },
126
- eslintConfigPrettier,
127
- ...[...tseslint.configs.recommended, ...tseslint.configs.stylistic].map(
128
- ({ plugins, ...config }) => ({
129
- ...config,
130
- files: [`**/*.{${tsExtensions}}`],
131
- }),
132
- ),
133
- {
134
- files: [`**/*.{${tsExtensions}}`],
135
-
136
- languageOptions: {
137
- parser: tseslint.parser,
138
-
139
- parserOptions: {
140
- projectService: true,
141
- warnOnUnsupportedTypeScriptVersion: false,
142
- },
143
- },
144
- settings,
145
- rules: {
146
- '@typescript-eslint/array-type': [ERROR, { default: 'array-simple' }],
147
- '@typescript-eslint/consistent-type-definitions': OFF,
148
- '@typescript-eslint/no-unused-expressions': ERROR,
149
- '@typescript-eslint/no-unused-vars': [
150
- ERROR,
151
- { argsIgnorePattern: '^_', ignoreRestSiblings: true },
152
- ],
153
- '@typescript-eslint/no-use-before-define': OFF,
154
- '@typescript-eslint/no-non-null-assertion': OFF,
155
- '@typescript-eslint/ban-ts-comment': OFF,
156
- '@typescript-eslint/no-explicit-any': OFF,
157
- '@typescript-eslint/explicit-function-return-type': OFF,
158
- '@typescript-eslint/no-empty-function': OFF,
159
- '@typescript-eslint/no-empty-interface': OFF,
160
- '@typescript-eslint/no-inferrable-types': [
161
- ERROR,
162
- { ignoreParameters: true },
163
- ],
164
- // prefer TypeScript exhaustiveness checking
165
- // https://www.typescriptlang.org/docs/handbook/advanced-types.html#exhaustiveness-checking
166
- 'default-case': OFF,
167
- 'arrow-body-style': [ERROR, 'as-needed'],
168
- // Use `typescript-eslint`'s no-shadow to avoid false positives with enums
169
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
170
- 'no-shadow': OFF,
171
- '@typescript-eslint/no-shadow': ERROR,
172
-
173
- // These two rules deal with autofixing type imports/exports
174
- // https://typescript-eslint.io/rules/consistent-type-imports
175
- '@typescript-eslint/consistent-type-imports': [
176
- ERROR,
177
- { fixStyle: 'inline-type-imports' },
178
- ],
179
- // https://typescript-eslint.io/rules/consistent-type-exports
180
- '@typescript-eslint/consistent-type-exports': [
181
- ERROR,
182
- { fixMixedExportsWithInlineTypeSpecifier: true },
183
- ],
184
- // https://typescript-eslint.io/rules/no-import-type-side-effects
185
- '@typescript-eslint/no-import-type-side-effects': ERROR,
186
-
187
- // This rule deals with merging multiple imports from the same module.
188
- // In this case, we want type imports to be inlined when merging with the other imports.
189
- // However, there is a pending PR which improves the behaviour of this rule https://github.com/import-js/eslint-plugin-import/pull/2716
190
- // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-duplicates.md#inline-type-imports
191
- 'import-x/no-duplicates': [ERROR, { 'prefer-inline': true }],
192
- 'import-x/export': ERROR,
193
- },
194
- },
195
- {
196
- files: [`**/*.{${jsExtensions}}`],
197
- languageOptions: {
198
- globals: {},
199
- },
200
- settings,
201
- rules: {
202
- 'no-undef': ERROR,
203
- 'no-use-before-define': [ERROR, { functions: false }],
204
- 'no-unused-expressions': ERROR,
205
- 'import-x/no-unresolved': [
206
- ERROR,
207
- { commonjs: true, amd: true, ignore: ['.svg$', '^file?'] },
208
- ],
209
- 'import-x/no-duplicates': ERROR,
210
- 'import-x/export': ERROR,
211
- },
212
- },
213
- {
214
- ...jestPlugin.configs['flat/recommended'],
215
- files: [
216
- `**/__tests__/**/*.{${allExtensions}}`,
217
- `**/*.@(spec|test).{${allExtensions}}`,
218
- ],
219
- },
220
- {
221
- files: [
222
- `**/__tests__/**/*.{${allExtensions}}`,
223
- `**/*.@(spec|test).{${allExtensions}}`,
224
- ],
225
- languageOptions: {
226
- globals: {
227
- ...globals.jest,
228
- },
229
- },
230
- },
231
- {
232
- ...cypress.configs.recommended,
233
- files: [`**/cypress/**/*.{${allExtensions}}`],
234
- },
235
- ];
package/extensions.js DELETED
@@ -1,2 +0,0 @@
1
- module.exports.js = ['js', 'cjs', 'mjs', 'jsx'];
2
- module.exports.ts = ['ts', 'cts', 'mts', 'tsx'];
package/index.js DELETED
@@ -1,62 +0,0 @@
1
- const react = require('eslint-plugin-react');
2
- const reactHooks = require('eslint-plugin-react-hooks');
3
- const base = require('./base');
4
-
5
- const globals = require('globals');
6
-
7
- const OFF = 0;
8
- const ERROR = 2;
9
-
10
- const reactRules = {
11
- 'react/prefer-es6-class': [ERROR, 'always'],
12
- 'react/self-closing-comp': ERROR,
13
- 'react/jsx-pascal-case': ERROR,
14
- 'react-hooks/rules-of-hooks': ERROR,
15
- 'react-hooks/exhaustive-deps': ERROR,
16
- 'react/no-children-prop': ERROR,
17
- 'react/display-name': OFF,
18
- 'react/prop-types': OFF,
19
- 'react/jsx-curly-brace-presence': [
20
- ERROR,
21
- { props: 'never', children: 'ignore', propElementValues: 'always' },
22
- ],
23
- };
24
-
25
- module.exports = [
26
- react.configs.flat.recommended,
27
- react.configs.flat['jsx-runtime'],
28
- ...base,
29
- {
30
- plugins: {
31
- react,
32
- 'react-hooks': reactHooks,
33
- },
34
-
35
- languageOptions: {
36
- globals: globals.browser,
37
- },
38
-
39
- settings: {
40
- react: {
41
- version: 'detect',
42
- },
43
- },
44
-
45
- rules: reactRules,
46
- },
47
- {
48
- files: ['**/*.tsx'],
49
-
50
- rules: {
51
- // temporary override until everybody removes the React import
52
- '@typescript-eslint/no-unused-vars': [
53
- ERROR,
54
- {
55
- argsIgnorePattern: '^_',
56
- ignoreRestSiblings: true,
57
- varsIgnorePattern: '^React$',
58
- },
59
- ],
60
- },
61
- },
62
- ];