@map-colonies/eslint-config 4.0.0 → 7.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/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # ESLint config
2
+
3
+ A collection of [ESLint](https://eslint.org/) configs for various frameworks and environments.
4
+ The package only supports eslint 9 and above using the flat configuration.
5
+
6
+ ## Available Configs
7
+
8
+ - **ts-base**: base configurations for TypeScript.
9
+ - **React**: rules for React (extends react-app).
10
+ - **Jest**: rules for Jest.
11
+
12
+ ## Installation
13
+
14
+ ### base
15
+ ```bash
16
+ $ npm install --save-dev eslint @map-colonies/eslint-config
17
+ ```
18
+
19
+ ### react
20
+ ```
21
+ $ npm install --save-dev @map-colonies/eslint-config eslint-plugin-react eslint-plugin-react-hooks
22
+ ```
23
+
24
+ ### jest
25
+ ```
26
+ $ npm install --save-dev @map-colonies/eslint-config eslint-plugin-jest
27
+ ```
28
+
29
+
30
+ ## Usage
31
+
32
+ Add the configs you want to the eslint configuration file of your choice. In this example we are using the file `eslint.config.mjs`
33
+ For more information check the following link [Configuration Files
34
+ ](https://eslint.org/docs/latest/use/configure/configuration-files).
35
+ <br/>
36
+ **Note:** make sure to add `ts-base` last.
37
+
38
+ ```javascript
39
+ import tsBaseConfig from '@map-colonies/eslint-config/ts-base';
40
+ import { config } from '@map-colonies/eslint-config/helpers';
41
+
42
+ export default config(tsBaseConfig);
43
+
44
+ ```
45
+
46
+ ## Debug
47
+ If you want to check the ESLint configuration, debug problems or just see the final configuration, you can the following command that will open the eslint configuration UI in your browser.
48
+
49
+ ```bash
50
+ npx eslint --inspect-config .
51
+ ```
52
+
53
+ For more information check the following link [debug](https://eslint.org/docs/latest/use/configure/debug).
54
+
55
+
56
+ ## Adding new Configs
57
+
58
+ Add a new file and name it as you would like. Inside export the ESLint configuration.
59
+
60
+ ```js
61
+ module.exports = {
62
+ extends: ['plugin:jest/recommended', 'plugin:jest/style'],
63
+ plugins: ['jest'],
64
+ env: {
65
+ 'jest/globals': true,
66
+ },
67
+ };
68
+ ```
69
+
70
+ after you finished developing the config, make sure it works by using the `--print-config` flag of ESLint, in the project you use for testing.
71
+
72
+ ```bash
73
+ $ npx eslint --print-config index.ts
74
+ ```
75
+
76
+ Don't forget adding the config to this readme :blush:
77
+
78
+ ## Issues
79
+ If any linting error is appearing twice, or you have any other problem, please open an issue with all the details you have.
@@ -0,0 +1,15 @@
1
+ declare const jestConfig: import("typescript-eslint").FlatConfig.ConfigArray;
2
+ /**
3
+ * The default export for the Jest configuration.
4
+ * This configuration is used to set up and customize the behavior of Jest,
5
+ * a JavaScript testing framework.
6
+ *
7
+ * @group configs
8
+ * @example
9
+ * import jestConfig from '@map-colonies/eslint-config/jest';
10
+ * import { config } from '@map-colonies/eslint-config/helpers';
11
+ *
12
+ * export default config(jestConfig);
13
+ */
14
+ export default jestConfig;
15
+ //# sourceMappingURL=jest.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jest.d.mts","sourceRoot":"","sources":["../../src/configs/jest.mts"],"names":[],"mappings":"AAMA,QAAA,MAAM,UAAU,oDAWd,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,eAAe,UAAU,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { config } from '../helpers.mjs';
2
+ import { importOrThrow } from '../internal/helpers.js';
3
+ const jestPlugin = await importOrThrow('eslint-plugin-jest');
4
+ const jestConfig = config({
5
+ name: 'map-colonies/jest/rules',
6
+ files: ['**/*.test.ts', '**/*.test.tsx', '**/*.spec.ts', '**/*.spec.tsx'],
7
+ plugins: { jest: jestPlugin },
8
+ languageOptions: {
9
+ globals: jestPlugin.environments.globals.globals,
10
+ },
11
+ rules: {
12
+ ...jestPlugin.configs.recommended.rules,
13
+ ...jestPlugin.configs.style.rules,
14
+ },
15
+ });
16
+ /**
17
+ * The default export for the Jest configuration.
18
+ * This configuration is used to set up and customize the behavior of Jest,
19
+ * a JavaScript testing framework.
20
+ *
21
+ * @group configs
22
+ * @example
23
+ * import jestConfig from '@map-colonies/eslint-config/jest';
24
+ * import { config } from '@map-colonies/eslint-config/helpers';
25
+ *
26
+ * export default config(jestConfig);
27
+ */
28
+ export default jestConfig;
29
+ //# sourceMappingURL=jest.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jest.mjs","sourceRoot":"","sources":["../../src/configs/jest.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,UAAU,GAAG,MAAM,aAAa,CAAwB,oBAAoB,CAAC,CAAC;AAEpF,MAAM,UAAU,GAAG,MAAM,CAAC;IACxB,IAAI,EAAE,yBAAyB;IAC/B,KAAK,EAAE,CAAC,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,CAAC;IACzE,OAAO,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;IAC7B,eAAe,EAAE;QACf,OAAO,EAAE,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO;KACjD;IACD,KAAK,EAAE;QACL,GAAG,UAAU,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK;QACvC,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK;KAClC;CACF,CAAC,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,eAAe,UAAU,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type tseslint from 'typescript-eslint';
2
+ /**
3
+ * Combined React and React Hooks ESLint configuration
4
+ *
5
+ * Provides ESLint rules for React and React Hooks, including:
6
+ * - React recommended rules
7
+ * - JSX runtime configuration
8
+ * - Browser globals
9
+ * - React version detection
10
+ * - Custom React rules (boolean prop naming, useState hook usage)
11
+ * - React Hooks recommended rules
12
+ *
13
+ * @group configs
14
+ * @example
15
+ * import reactConfig from '@map-colonies/eslint-config/react';
16
+ * import { config } from '@map-colonies/eslint-config/helpers';
17
+ *
18
+ * export default config(reactConfig);
19
+ */
20
+ declare const _default: tseslint.FlatConfig.ConfigArray;
21
+ export default _default;
22
+ //# sourceMappingURL=react.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.d.mts","sourceRoot":"","sources":["../../src/configs/react.mts"],"names":[],"mappings":"AAEA,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAmC9C;;;;;;;;;;;;;;;;;GAiBG;;AACH,wBAAmD"}
@@ -0,0 +1,48 @@
1
+ import { config } from '../helpers.mjs';
2
+ import { importOrThrow } from '../internal/helpers.js';
3
+ const reactPlugin = await importOrThrow('eslint-plugin-react');
4
+ const pluginReactHooks = await importOrThrow('eslint-plugin-react-hooks');
5
+ const importedGlobals = await importOrThrow('globals');
6
+ const reactRules = config(reactPlugin.configs.flat.recommended ?? {}, reactPlugin.configs.flat['jsx-runtime'] ?? {}, {
7
+ name: 'map-colonies/react/rules',
8
+ files: ['**/*.tsx'],
9
+ languageOptions: {
10
+ globals: importedGlobals.browser,
11
+ },
12
+ settings: {
13
+ react: {
14
+ version: 'detect',
15
+ },
16
+ },
17
+ rules: {
18
+ 'react/boolean-prop-naming': 'error',
19
+ 'react/hook-use-state': 'error',
20
+ 'react/prop-types': 'off',
21
+ },
22
+ });
23
+ const reactHooksRules = config({
24
+ name: 'map-colonies/react-hooks/rules',
25
+ files: ['**/*.tsx'],
26
+ plugins: { 'react-hooks': pluginReactHooks },
27
+ rules: pluginReactHooks.configs.recommended.rules,
28
+ });
29
+ /**
30
+ * Combined React and React Hooks ESLint configuration
31
+ *
32
+ * Provides ESLint rules for React and React Hooks, including:
33
+ * - React recommended rules
34
+ * - JSX runtime configuration
35
+ * - Browser globals
36
+ * - React version detection
37
+ * - Custom React rules (boolean prop naming, useState hook usage)
38
+ * - React Hooks recommended rules
39
+ *
40
+ * @group configs
41
+ * @example
42
+ * import reactConfig from '@map-colonies/eslint-config/react';
43
+ * import { config } from '@map-colonies/eslint-config/helpers';
44
+ *
45
+ * export default config(reactConfig);
46
+ */
47
+ export default config(reactRules, reactHooksRules);
48
+ //# sourceMappingURL=react.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.mjs","sourceRoot":"","sources":["../../src/configs/react.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAIvD,MAAM,WAAW,GAAG,MAAM,aAAa,CAAyB,qBAAqB,CAAC,CAAC;AACvF,MAAM,gBAAgB,GAAG,MAAM,aAAa,CAAmB,2BAA2B,CAAC,CAAC;AAC5F,MAAM,eAAe,GAAG,MAAM,aAAa,CAAyF,SAAS,CAAC,CAAC;AAE/I,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,EAAE;IACnH,IAAI,EAAE,0BAA0B;IAChC,KAAK,EAAE,CAAC,UAAU,CAAC;IACnB,eAAe,EAAE;QACf,OAAO,EAAE,eAAe,CAAC,OAAO;KACjC;IACD,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,OAAO,EAAE,QAAQ;SAClB;KACF;IACD,KAAK,EAAE;QACL,2BAA2B,EAAE,OAAO;QACpC,sBAAsB,EAAE,OAAO;QAC/B,kBAAkB,EAAE,KAAK;KAC1B;CACF,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG,MAAM,CAAC;IAC7B,IAAI,EAAE,gCAAgC;IACtC,KAAK,EAAE,CAAC,UAAU,CAAC;IACnB,OAAO,EAAE,EAAE,aAAa,EAAE,gBAAgB,EAAE;IAC5C,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK;CAClD,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAe,MAAM,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * ESLint naming convention rules for TypeScript projects
3
+ *
4
+ * Defines naming patterns for:
5
+ * - Default identifiers (camelCase)
6
+ * - Variables (camelCase, UPPER_CASE, PascalCase for providers)
7
+ * - Parameters (camelCase with optional leading underscore)
8
+ * - Private members (camelCase)
9
+ * - Enum members (UPPER_CASE)
10
+ * - Types (PascalCase)
11
+ * - Quoted properties (any format)
12
+ */
13
+ export declare const namingConventions: ["error", {
14
+ readonly selector: "default";
15
+ readonly format: readonly ["camelCase"];
16
+ }, {
17
+ readonly selector: "variable";
18
+ readonly format: readonly ["camelCase", "UPPER_CASE"];
19
+ }, {
20
+ readonly selector: "variable";
21
+ readonly format: readonly ["PascalCase"];
22
+ readonly filter: {
23
+ readonly regex: "^.*Provider$";
24
+ readonly match: true;
25
+ };
26
+ }, {
27
+ readonly selector: "parameter";
28
+ readonly format: readonly ["camelCase"];
29
+ readonly leadingUnderscore: "allow";
30
+ }, {
31
+ readonly selector: "memberLike";
32
+ readonly modifiers: readonly ["private"];
33
+ readonly format: readonly ["camelCase"];
34
+ }, {
35
+ readonly selector: "enumMember";
36
+ readonly format: readonly ["UPPER_CASE"];
37
+ }, {
38
+ readonly selector: readonly ["classProperty", "objectLiteralProperty", "typeProperty", "classMethod", "objectLiteralMethod", "typeMethod", "accessor", "enumMember"];
39
+ readonly format: null;
40
+ readonly modifiers: readonly ["requiresQuotes"];
41
+ }, {
42
+ readonly selector: "typeLike";
43
+ readonly format: readonly ["PascalCase"];
44
+ }];
45
+ declare const combinedConfig: import("eslint/config").Config[];
46
+ /**
47
+ * Combined ESLint configuration for TypeScript projects
48
+ * Includes:
49
+ * - ESLint recommended rules
50
+ * - TypeScript-ESLint recommended rules with type checking
51
+ * - Custom TypeScript rules
52
+ * - Jest-specific rule overrides
53
+ * - React component naming conventions
54
+ * - Import organization rules
55
+ * - Global ignores for build artifacts and dependencies
56
+ * - Parser configuration
57
+ * - Prettier integration
58
+ *
59
+ * @group configs
60
+ * @example
61
+ * import tsBaseConfig from '@map-colonies/eslint-config/ts-base';
62
+ * import { config } from '@map-colonies/eslint-config/helpers';
63
+ *
64
+ * export default config(tsBaseConfig);
65
+ */
66
+ export default combinedConfig;
67
+ //# sourceMappingURL=ts-base.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ts-base.d.mts","sourceRoot":"","sources":["../../src/configs/ts-base.mts"],"names":[],"mappings":"AASA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmDO,CAAC;AA6HtC,QAAA,MAAM,cAAc,kCAanB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAe,cAAc,CAAC"}
@@ -0,0 +1,212 @@
1
+ import eslint from '@eslint/js';
2
+ import { configs as tsEslintConfigs } from 'typescript-eslint';
3
+ import { flatConfigs as importFlatConfigs } from 'eslint-plugin-import-x';
4
+ import eslintConfigPrettier from 'eslint-config-prettier';
5
+ import tsParser from '@typescript-eslint/parser';
6
+ // import { config } from '../helpers.mjs';
7
+ import { defineConfig } from 'eslint/config';
8
+ /**
9
+ * ESLint naming convention rules for TypeScript projects
10
+ *
11
+ * Defines naming patterns for:
12
+ * - Default identifiers (camelCase)
13
+ * - Variables (camelCase, UPPER_CASE, PascalCase for providers)
14
+ * - Parameters (camelCase with optional leading underscore)
15
+ * - Private members (camelCase)
16
+ * - Enum members (UPPER_CASE)
17
+ * - Types (PascalCase)
18
+ * - Quoted properties (any format)
19
+ */
20
+ export const namingConventions = [
21
+ 'error',
22
+ {
23
+ selector: 'default',
24
+ format: ['camelCase'],
25
+ },
26
+ {
27
+ selector: 'variable',
28
+ format: ['camelCase', 'UPPER_CASE'],
29
+ },
30
+ {
31
+ selector: 'variable',
32
+ format: ['PascalCase'],
33
+ filter: {
34
+ regex: '^.*Provider$',
35
+ match: true,
36
+ },
37
+ },
38
+ {
39
+ selector: 'parameter',
40
+ format: ['camelCase'],
41
+ leadingUnderscore: 'allow',
42
+ },
43
+ {
44
+ selector: 'memberLike',
45
+ modifiers: ['private'],
46
+ format: ['camelCase'],
47
+ // leadingUnderscore: 'require',
48
+ },
49
+ {
50
+ selector: 'enumMember',
51
+ format: ['UPPER_CASE'],
52
+ },
53
+ {
54
+ selector: [
55
+ 'classProperty',
56
+ 'objectLiteralProperty',
57
+ 'typeProperty',
58
+ 'classMethod',
59
+ 'objectLiteralMethod',
60
+ 'typeMethod',
61
+ 'accessor',
62
+ 'enumMember',
63
+ ],
64
+ format: null,
65
+ modifiers: ['requiresQuotes'],
66
+ },
67
+ {
68
+ selector: 'typeLike',
69
+ format: ['PascalCase'],
70
+ },
71
+ ];
72
+ const typescriptEslintRules = defineConfig({
73
+ name: 'map-colonies/typescript-eslint/rules',
74
+ rules: {
75
+ '@typescript-eslint/array-type': ['error', { default: 'array' }],
76
+ '@typescript-eslint/ban-ts-comment': 'warn',
77
+ '@typescript-eslint/ban-tslint-comment': 'error',
78
+ '@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
79
+ '@typescript-eslint/explicit-function-return-type': 'warn',
80
+ '@typescript-eslint/explicit-member-accessibility': 'error',
81
+ '@typescript-eslint/member-ordering': 'warn',
82
+ '@typescript-eslint/method-signature-style': 'error',
83
+ '@typescript-eslint/no-empty-interface': 'off',
84
+ curly: 'error',
85
+ camelcase: 'off',
86
+ 'no-lonely-if': 'error',
87
+ '@typescript-eslint/naming-convention': namingConventions,
88
+ '@typescript-eslint/no-base-to-string': 'warn',
89
+ '@typescript-eslint/no-confusing-non-null-assertion': 'error',
90
+ '@typescript-eslint/no-extraneous-class': 'warn',
91
+ // '@typescript-eslint/no-throw-literal': 'error',
92
+ '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
93
+ '@typescript-eslint/no-unnecessary-condition': 'error',
94
+ '@typescript-eslint/no-unnecessary-type-arguments': 'warn',
95
+ '@typescript-eslint/prefer-literal-enum-member': 'error',
96
+ '@typescript-eslint/prefer-nullish-coalescing': 'warn',
97
+ '@typescript-eslint/prefer-optional-chain': 'warn',
98
+ '@typescript-eslint/prefer-readonly': 'error',
99
+ '@typescript-eslint/prefer-string-starts-ends-with': 'error',
100
+ '@typescript-eslint/promise-function-async': 'error',
101
+ '@typescript-eslint/require-array-sort-compare': 'warn',
102
+ '@typescript-eslint/strict-boolean-expressions': 'warn',
103
+ '@typescript-eslint/switch-exhaustiveness-check': 'error',
104
+ '@typescript-eslint/no-magic-numbers': [
105
+ 'error',
106
+ {
107
+ ignoreArrayIndexes: true,
108
+ ignore: [1, 0],
109
+ ignoreNumericLiteralTypes: true,
110
+ },
111
+ ],
112
+ '@typescript-eslint/default-param-last': 'error',
113
+ '@typescript-eslint/no-dupe-class-members': 'error',
114
+ '@typescript-eslint/no-unused-expressions': 'error',
115
+ '@typescript-eslint/no-unused-vars': ['warn', { ignoreRestSiblings: true }],
116
+ '@typescript-eslint/return-await': 'error',
117
+ },
118
+ });
119
+ // This is not in the jest config as it only turns rules off, and needs to be applied after the other rules
120
+ const jestTurnedOffRules = defineConfig({
121
+ name: 'map-colonies/jest/disabled-rules',
122
+ files: ['**/*.spec.ts?(x)', '**/*.test.ts?(x)'],
123
+ rules: {
124
+ '@typescript-eslint/no-magic-numbers': 'off',
125
+ '@typescript-eslint/explicit-function-return-type': 'off',
126
+ },
127
+ });
128
+ // // This is not in the react config as it only turns rules off, and needs to be applied after the other rules
129
+ const reactNamingConventions = defineConfig({
130
+ name: 'map-colonies/react/naming-conventions',
131
+ files: ['**/*.tsx'],
132
+ rules: {
133
+ '@typescript-eslint/naming-convention': [
134
+ ...namingConventions,
135
+ {
136
+ selector: 'variable',
137
+ format: ['camelCase', 'PascalCase'],
138
+ types: ['function'],
139
+ },
140
+ ],
141
+ },
142
+ });
143
+ const importRulesAndConfig = defineConfig({
144
+ name: 'map-colonies/import-x/rules',
145
+ files: ['**/*.ts?(x)'],
146
+ ignores: ['eslint.config.*'],
147
+ languageOptions: {
148
+ parser: tsParser,
149
+ ecmaVersion: 'latest',
150
+ sourceType: 'module',
151
+ },
152
+ rules: {
153
+ 'import-x/order': [
154
+ 'error',
155
+ {
156
+ pathGroups: [
157
+ {
158
+ pattern: '@**',
159
+ group: 'external',
160
+ position: 'after',
161
+ },
162
+ {
163
+ pattern: '@*/**',
164
+ group: 'external',
165
+ position: 'after',
166
+ },
167
+ ],
168
+ },
169
+ ],
170
+ 'import-x/first': 'error',
171
+ 'import-x/exports-last': 'error',
172
+ 'import-x/newline-after-import': 'error',
173
+ },
174
+ });
175
+ const globalIgnoreConfig = defineConfig({
176
+ name: 'map-colonies/global-ignore',
177
+ ignores: ['.husky', 'coverage', 'reports', 'dist', 'node_modules', '**/*.{js,mjs,cjs}', 'helm'],
178
+ });
179
+ const parserOptions = defineConfig({
180
+ name: 'map-colonies/parser-options',
181
+ languageOptions: {
182
+ parserOptions: {
183
+ projectService: true,
184
+ tsconfigRootDir: process.cwd(),
185
+ },
186
+ },
187
+ });
188
+ const combinedConfig = defineConfig(eslint.configs.recommended, tsEslintConfigs.recommendedTypeChecked, typescriptEslintRules, jestTurnedOffRules, reactNamingConventions,
189
+ //@ts-expect-error it works and a known issue https://github.com/un-ts/eslint-plugin-import-x/issues/421
190
+ importFlatConfigs.recommended, { name: 'import-x/typescript', ...importFlatConfigs.typescript }, importRulesAndConfig, globalIgnoreConfig, parserOptions, { name: 'eslint-prettier/disabled-rules', ...eslintConfigPrettier });
191
+ /**
192
+ * Combined ESLint configuration for TypeScript projects
193
+ * Includes:
194
+ * - ESLint recommended rules
195
+ * - TypeScript-ESLint recommended rules with type checking
196
+ * - Custom TypeScript rules
197
+ * - Jest-specific rule overrides
198
+ * - React component naming conventions
199
+ * - Import organization rules
200
+ * - Global ignores for build artifacts and dependencies
201
+ * - Parser configuration
202
+ * - Prettier integration
203
+ *
204
+ * @group configs
205
+ * @example
206
+ * import tsBaseConfig from '@map-colonies/eslint-config/ts-base';
207
+ * import { config } from '@map-colonies/eslint-config/helpers';
208
+ *
209
+ * export default config(tsBaseConfig);
210
+ */
211
+ export default combinedConfig;
212
+ //# sourceMappingURL=ts-base.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ts-base.mjs","sourceRoot":"","sources":["../../src/configs/ts-base.mts"],"names":[],"mappings":"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"}
@@ -0,0 +1,24 @@
1
+ import { config as importedConfig } from 'typescript-eslint';
2
+ /**
3
+ * Utility function to make it easy to strictly type your "Flat" config file
4
+ * @example
5
+ * ```js
6
+ * // @ts-check
7
+ *
8
+ * import eslint from '@eslint/js';
9
+ * import tseslint from 'typescript-eslint';
10
+ *
11
+ * export default tseslint.config(
12
+ * eslint.configs.recommended,
13
+ * tseslint.configs.recommended,
14
+ * {
15
+ * rules: {
16
+ * '@typescript-eslint/array-type': 'error',
17
+ * },
18
+ * },
19
+ * );
20
+ * ```
21
+ */
22
+ declare const config: typeof importedConfig;
23
+ export { config };
24
+ //# sourceMappingURL=helpers.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.mts","sourceRoot":"","sources":["../src/helpers.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,MAAM,uBAAiB,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { config as importedConfig } from 'typescript-eslint';
2
+ /**
3
+ * Utility function to make it easy to strictly type your "Flat" config file
4
+ * @example
5
+ * ```js
6
+ * // @ts-check
7
+ *
8
+ * import eslint from '@eslint/js';
9
+ * import tseslint from 'typescript-eslint';
10
+ *
11
+ * export default tseslint.config(
12
+ * eslint.configs.recommended,
13
+ * tseslint.configs.recommended,
14
+ * {
15
+ * rules: {
16
+ * '@typescript-eslint/array-type': 'error',
17
+ * },
18
+ * },
19
+ * );
20
+ * ```
21
+ */
22
+ const config = importedConfig;
23
+ export { config };
24
+ //# sourceMappingURL=helpers.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.mjs","sourceRoot":"","sources":["../src/helpers.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,GAAG,cAAc,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function importOrThrow<T extends object>(modulePath: string): Promise<T>;
2
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/internal/helpers.ts"],"names":[],"mappings":"AAAA,wBAAsB,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAWpF"}
@@ -0,0 +1,13 @@
1
+ export async function importOrThrow(modulePath) {
2
+ try {
3
+ const imported = (await import(modulePath));
4
+ if ('default' in imported) {
5
+ return imported.default;
6
+ }
7
+ return imported;
8
+ }
9
+ catch (error) {
10
+ throw new Error(`Failed to import optional module '${modulePath}', make sure its installed and try again`, { cause: error });
11
+ }
12
+ }
13
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/internal/helpers.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,aAAa,CAAmB,UAAkB;IACtE,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,CAAC,MAAM,MAAM,CAAC,UAAU,CAAC,CAAM,CAAC;QAEjD,IAAI,SAAS,IAAI,QAAQ,EAAE,CAAC;YAC1B,OAAO,QAAQ,CAAC,OAAY,CAAC;QAC/B,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,qCAAqC,UAAU,0CAA0C,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAC/H,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,49 +1,82 @@
1
1
  {
2
2
  "name": "@map-colonies/eslint-config",
3
- "version": "4.0.0",
3
+ "version": "7.0.0",
4
4
  "description": "eslint configs for map colonies organization",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1",
8
- "release": "standard-version"
9
- },
10
- "repository": {
11
- "type": "git",
12
- "url": "git+https://github.com/MapColonies/eslint-config.git"
13
- },
14
- "author": "MapColonies",
15
- "license": "MIT",
16
- "bugs": {
17
- "url": "https://github.com/MapColonies/eslint-config/issues"
18
- },
19
- "homepage": "https://github.com/MapColonies/eslint-config#readme",
20
- "husky": {
21
- "hooks": {
22
- "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
5
+ "type": "module",
6
+ "exports": {
7
+ "./ts-base": {
8
+ "types": "./dist/configs/ts-base.d.mts",
9
+ "import": "./dist/configs/ts-base.mjs"
10
+ },
11
+ "./react": {
12
+ "types": "./dist/configs/react.d.mts",
13
+ "import": "./dist/configs/react.mjs"
14
+ },
15
+ "./jest": {
16
+ "types": "./dist/configs/jest.d.mts",
17
+ "import": "./dist/configs/jest.mjs"
18
+ },
19
+ "./helpers": {
20
+ "types": "./dist/helpers.d.mts",
21
+ "import": "./dist/helpers.mjs"
23
22
  }
24
23
  },
25
- "config": {
26
- "commitizen": {
27
- "path": "./node_modules/cz-conventional-changelog"
28
- }
24
+ "files": [
25
+ "dist/**/*"
26
+ ],
27
+ "engines": {
28
+ "node": ">=24"
29
29
  },
30
+ "repository": "github:MapColonies/infra-packages",
30
31
  "peerDependencies": {
31
- "eslint": "^8.15.0"
32
+ "eslint": "^9.19.0",
33
+ "eslint-plugin-jest": "^28.11.0",
34
+ "eslint-plugin-react": "^7.37.4",
35
+ "eslint-plugin-react-hooks": "^5.1.0",
36
+ "globals": "^15.14.0"
37
+ },
38
+ "peerDependenciesMeta": {
39
+ "eslint-plugin-jest": {
40
+ "optional": true
41
+ },
42
+ "eslint-plugin-react": {
43
+ "optional": true
44
+ },
45
+ "eslint-plugin-react-hooks": {
46
+ "optional": true
47
+ },
48
+ "globals": {
49
+ "optional": true
50
+ }
32
51
  },
33
52
  "dependencies": {
34
- "@typescript-eslint/eslint-plugin": "6.7.3",
35
- "@typescript-eslint/parser": "6.7.3",
36
- "eslint-config-prettier": "^8.5.0",
37
- "eslint-config-react-app": "^7.0.1",
38
- "eslint-plugin-import": "^2.26.0",
39
- "eslint-plugin-jest": "^27.4.0"
53
+ "@eslint/js": "^9.19.0",
54
+ "eslint-config-prettier": "^10.0.1",
55
+ "eslint-import-resolver-typescript": "^3.7.0",
56
+ "eslint-plugin-import-x": "^4.16.1",
57
+ "@typescript-eslint/parser": "^8.23.0",
58
+ "typescript-eslint": "^8.23.0"
40
59
  },
41
60
  "devDependencies": {
42
- "@commitlint/cli": "^17.0.0",
43
- "@commitlint/config-conventional": "^17.0.0",
44
- "commitlint": "^17.0.0",
45
- "cz-conventional-changelog": "^3.3.0",
46
- "husky": "^8.0.1",
47
- "standard-version": "^9.5.0"
61
+ "@types/node": "24.0.0",
62
+ "eslint": "^9.39.1",
63
+ "typescript": "5.9.3",
64
+ "eslint-plugin-react-hooks": "5.2.0",
65
+ "eslint-plugin-jest": "28.14.0",
66
+ "eslint-plugin-react": "7.37.5",
67
+ "vitest": "^4.0.15",
68
+ "@map-colonies/tsconfig": "^2.0.0",
69
+ "vitest-config": "^0.0.0"
70
+ },
71
+ "scripts": {
72
+ "lint": "eslint .",
73
+ "lint:fix": "eslint --fix .",
74
+ "pretest": "turbo run build",
75
+ "test": "vitest run",
76
+ "prebuild": "pnpm run clean",
77
+ "clean": "rimraf dist",
78
+ "build": "tsc --project tsconfig.build.json",
79
+ "check-dist": "publint && attw --profile esm-only --pack .",
80
+ "knip": "knip --directory ../.. --workspace packages/eslint-config"
48
81
  }
49
- }
82
+ }
package/.licrc DELETED
@@ -1,19 +0,0 @@
1
- [licenses]
2
- # This indicates which are the only licenses that Licensebat will accept.
3
- # The rest will be flagged as not allowed.
4
- #accepted = ["MIT", "MSC", "BSD"]
5
- # This will indicate which licenses are not accepted.
6
- # The rest will be accepted, except for the unknown licenses or dependencies without licenses.
7
- unaccepted = ["LGPL"]
8
- # Note that only one of the previous options can be enabled at once.
9
- # If both of them are informed, only accepted will be considered.
10
-
11
- [dependencies]
12
- # This will allow users to flag some dependencies so that Licensebat will not check for their license.
13
- ignored=["ignored_dep1", "ignored_dep2"]
14
-
15
- [behavior]
16
- # False by default, if true, it will only run the checks when one of the dependency files or the .licrc file has been modified.
17
- run_only_on_dependency_modification = true
18
- # False by default, if true, it will never block the build.
19
- do_not_block_pr = true
package/CHANGELOG.md DELETED
@@ -1,108 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
-
5
- ## [4.0.0](https://github.com/MapColonies/eslint-config/compare/v3.1.3...v4.0.0) (2023-09-30)
6
-
7
-
8
- ### ⚠ BREAKING CHANGES
9
-
10
- * **deps:** keep packages up-to-date (#31)
11
-
12
- ### Features
13
-
14
- * added backstage docs ([4bdc3cc](https://github.com/MapColonies/eslint-config/commit/4bdc3cc0c02f24ebdc0bf05affeed2596a198055))
15
-
16
-
17
- ### build
18
-
19
- * **deps:** keep packages up-to-date ([#31](https://github.com/MapColonies/eslint-config/issues/31)) ([002a6a6](https://github.com/MapColonies/eslint-config/commit/002a6a6a8e9d3fc231216fb4cc084d602877a4f3))
20
-
21
- ### [3.1.3](https://github.com/MapColonies/eslint-config/compare/v3.1.2...v3.1.3) (2022-09-22)
22
-
23
- ### [3.1.2](https://github.com/MapColonies/eslint-config/compare/v3.1.1...v3.1.2) (2022-09-22)
24
-
25
- ### [3.1.1](https://github.com/MapColonies/eslint-config/compare/v3.1.0...v3.1.1) (2022-05-18)
26
-
27
- ## [3.1.0](https://github.com/MapColonies/eslint-config/compare/v3.0.1...v3.1.0) (2022-04-27)
28
-
29
- ### [3.0.1](https://github.com/MapColonies/eslint-config/compare/v3.0.0...v3.0.1) (2021-10-19)
30
-
31
-
32
- ### Bug Fixes
33
-
34
- * merged prettier/[@typescript-eslint](https://github.com/typescript-eslint) -> prettier ([f34d9dc](https://github.com/MapColonies/eslint-config/commit/f34d9dcf7665c66119fe4865bda964b9492789e0))
35
-
36
- ## [3.0.0](https://github.com/MapColonies/eslint-config/compare/v2.2.1...v3.0.0) (2021-10-19)
37
-
38
-
39
- ### ⚠ BREAKING CHANGES
40
-
41
- * upgrade to eslint v8
42
-
43
- * upgrade to eslint v8 ([ff2b536](https://github.com/MapColonies/eslint-config/commit/ff2b5367c1bd366ca1513345cacae16a20af8fda))
44
-
45
- ### [2.2.1](https://github.com/MapColonies/eslint-config/compare/v2.2.0...v2.2.1) (2021-06-06)
46
-
47
- ## [2.2.0](https://github.com/MapColonies/eslint-config/compare/v2.1.0...v2.2.0) (2021-02-01)
48
-
49
-
50
- ### Features
51
-
52
- * **ts-base:** added no-unused-vars ([#14](https://github.com/MapColonies/eslint-config/issues/14)) ([4a29a0e](https://github.com/MapColonies/eslint-config/commit/4a29a0e1d7f5b3fb680b947d0ca5f3a7380a1206))
53
-
54
- ## [2.1.0](https://github.com/MapColonies/eslint-config/compare/v2.1.0-0...v2.1.0) (2021-01-13)
55
-
56
- ## [2.1.0-0](https://github.com/MapColonies/eslint-config/compare/v2.0.0...v2.1.0-0) (2021-01-13)
57
-
58
-
59
- ### Features
60
-
61
- * added more bracket rules ([317dc7a](https://github.com/MapColonies/eslint-config/commit/317dc7a8680cb05259b5a78651f83e8c41638816))
62
-
63
- ## [2.0.0](https://github.com/MapColonies/eslint-config/compare/v1.1.0...v2.0.0) (2020-12-15)
64
-
65
-
66
- ### ⚠ BREAKING CHANGES
67
-
68
- * **deps:** changed deps for typescript 4 versions (#11)
69
-
70
- ### build
71
-
72
- * **deps:** changed deps for typescript 4 versions ([#11](https://github.com/MapColonies/eslint-config/issues/11)) ([4bd9177](https://github.com/MapColonies/eslint-config/commit/4bd9177fe07eec16a557f9178aa4cf1723feb167))
73
-
74
- ## [1.1.0](https://github.com/MapColonies/eslint-config/compare/v1.0.3...v1.1.0) (2020-09-02)
75
-
76
-
77
- ### Features
78
-
79
- * **ts-base:** ignored magic numbers in stories, and enabled order import rule ([#9](https://github.com/MapColonies/eslint-config/issues/9)) ([6234db7](https://github.com/MapColonies/eslint-config/commit/6234db7916e54cb7592c3037a29b1fed3d57cd0f))
80
-
81
- ### [1.0.3](https://github.com/MapColonies/eslint-config/compare/v1.0.2...v1.0.3) (2020-08-04)
82
-
83
-
84
- ### Bug Fixes
85
-
86
- * **ts-base:** fixed errors with integration ([#8](https://github.com/MapColonies/eslint-config/issues/8)) ([12be01f](https://github.com/MapColonies/eslint-config/commit/12be01f1b7932a04a52b862f386d694af029ded0))
87
-
88
- ### [1.0.2](https://github.com/MapColonies/eslint-config/compare/v1.0.1...v1.0.2) (2020-08-03)
89
-
90
-
91
- ### Bug Fixes
92
-
93
- * **ts-base:** typo ([93a0d62](https://github.com/MapColonies/eslint-config/commit/93a0d623a819a51a14a4224eea6a9c87202bcbc6))
94
-
95
- ### [1.0.1](https://github.com/MapColonies/eslint-config/compare/v1.0.0...v1.0.1) (2020-08-03)
96
-
97
-
98
- ### Bug Fixes
99
-
100
- * **ts-base:** fixed PR ([8b4cb52](https://github.com/MapColonies/eslint-config/commit/8b4cb529c4e2047909d9a983ff6a0e45ed23b666))
101
- * **ts-base:** tweaked rules based on conflict-ui integration ([9b020c1](https://github.com/MapColonies/eslint-config/commit/9b020c1370109df9535cc9ea5fb621fc8c21aae0))
102
-
103
- ## 1.0.0 (2020-08-02)
104
-
105
-
106
- ### Features
107
-
108
- * **ts-base, jest, react:** added configs ([#2](https://github.com/MapColonies/eslint-config/issues/2)) ([c8da394](https://github.com/MapColonies/eslint-config/commit/c8da39496c56909f8e2523e7b640797369a29601))
package/catalog-info.yaml DELETED
@@ -1,15 +0,0 @@
1
- apiVersion: backstage.io/v1alpha1
2
- kind: Component
3
- metadata:
4
- name: eslint-config
5
- description: Opionated eslint configuration for MapColonies
6
- annotations:
7
- github.com/project-slug: MapColonies/eslint-config
8
- tags:
9
- - nodejs
10
- - typescript
11
- spec:
12
- type: library
13
- lifecycle: production
14
- owner: DevInfra
15
- system: npm-packages
@@ -1 +0,0 @@
1
- module.exports = { extends: ['@commitlint/config-conventional'] };
package/jest.js DELETED
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- extends: ['plugin:jest/recommended', 'plugin:jest/style'],
3
- plugins: ['jest'],
4
- env: {
5
- 'jest/globals': true,
6
- },
7
- };
package/react.js DELETED
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- extends: ['react-app', 'prettier', 'prettier/flowtype', 'prettier/react'],
3
- };
package/readme.md DELETED
@@ -1,71 +0,0 @@
1
- # Map Colonies ESLint configs
2
-
3
- A collection of ESlint configs for various frameworks and enviornments.
4
-
5
- ## Available Configs
6
-
7
- - **ts-base**: base configurations for typescript.
8
- - **react**: rules for react (extends react-app).
9
- - **jest**: rules for jest.
10
-
11
- ## Installation
12
-
13
- ```
14
- $ npm install --save-dev eslint @map-colonies/eslint-config
15
- ```
16
-
17
- or
18
-
19
- ```
20
- $ yarn add --dev eslint @map-colonies/eslint-config
21
- ```
22
-
23
- ## Usage
24
-
25
- Add the configs you want to the extend section of your `eslintConfig` of your `package.json`, or to your `.eslintrc` configuration file.
26
- <br/>
27
- **Note:** make sure to add `ts-base` last.
28
-
29
- ```
30
- "eslintConfig": {
31
- "extends": [
32
- "@map-colonies/eslint-config/react",
33
- "@map-colonies/eslint-config/ts-base"
34
- ]
35
- }
36
- ```
37
-
38
- Then add the path to your TypeScript configuration file to the `parserOptions`
39
-
40
- ```
41
- "eslintConfig": {
42
- "parserOptions": {
43
- "project": "./path/to/your/tsconfig.json"
44
- }
45
- }
46
- ```
47
-
48
- ## Adding new Configs
49
-
50
- Add a new file and name it as you would like. Inside export the ESLint configuration.
51
-
52
- ```
53
- module.exports = {
54
- extends: ['plugin:jest/recommended', 'plugin:jest/style'],
55
- plugins: ['jest'],
56
- env: {
57
- 'jest/globals': true,
58
- },
59
- };
60
- ```
61
-
62
- after you finished developing the config, make sure it works by using the `--print-config` flag of ESLint, in the project you use for testing.
63
-
64
- ```
65
- $ npx eslint --print-config index.ts
66
- ```
67
-
68
- Dont forget adding the config to this readme :blush:
69
-
70
- ## Issues
71
- If any linting error is appearing twice, or you have any other problem, please open an issue with all the details you have.
package/ts-base.js DELETED
@@ -1,184 +0,0 @@
1
- const namingConventions = [
2
- 'error',
3
- {
4
- selector: 'default',
5
- format: ['camelCase'],
6
- },
7
- {
8
- selector: 'variable',
9
- format: ['camelCase', 'UPPER_CASE'],
10
- },
11
- {
12
- selector: 'variable',
13
- format: ['PascalCase'],
14
- filter: {
15
- regex: '^.*Provider$',
16
- match: true,
17
- },
18
- },
19
- {
20
- selector: 'parameter',
21
- format: ['camelCase'],
22
- leadingUnderscore: 'allow',
23
- },
24
- {
25
- selector: 'memberLike',
26
- modifiers: ['private'],
27
- format: ['camelCase'],
28
- // leadingUnderscore: 'require',
29
- },
30
- {
31
- selector: 'enumMember',
32
- format: ['UPPER_CASE'],
33
- },
34
- {
35
- selector: 'typeLike',
36
- format: ['PascalCase'],
37
- },
38
- ];
39
-
40
- module.exports = {
41
- extends: [
42
- 'eslint:recommended',
43
- 'plugin:@typescript-eslint/recommended',
44
- 'plugin:@typescript-eslint/recommended-requiring-type-checking',
45
- "prettier"
46
- ],
47
- plugins: ['import', '@typescript-eslint'],
48
- parser: '@typescript-eslint/parser',
49
- parserOptions: {
50
- ecmaVersion: 2018,
51
- sourceType: 'module',
52
- },
53
- env: {
54
- browser: true,
55
- es6: true,
56
- node: true,
57
- },
58
- // overrides for TSX (mostly for react)
59
- overrides: [
60
- {
61
- files: ['**/*.tsx'],
62
- rules: {
63
- '@typescript-eslint/naming-convention': [
64
- ...namingConventions,
65
- {
66
- selector: 'variable',
67
- types: ['function'],
68
- format: ['camelCase', 'PascalCase'],
69
- },
70
- ],
71
- },
72
- },
73
- // overrides for storybook
74
- {
75
- files: ['**/*.stories.ts?(x)'],
76
- rules: {
77
- '@typescript-eslint/no-magic-numbers': 'off',
78
- },
79
- },
80
- // overrides for unit tests
81
- {
82
- files: ['**/*.spec.ts?(x)', '**/*.test.ts?(x)'],
83
- rules: {
84
- '@typescript-eslint/no-magic-numbers': 'off',
85
- '@typescript-eslint/explicit-function-return-type': 'off',
86
- },
87
- },
88
- ],
89
- rules: {
90
- '@typescript-eslint/array-type': ['error', { default: 'array' }],
91
-
92
- '@typescript-eslint/ban-ts-comment': 'warn',
93
-
94
- '@typescript-eslint/ban-tslint-comment': 'error',
95
-
96
- '@typescript-eslint/ban-types': 'error',
97
-
98
- '@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
99
-
100
- '@typescript-eslint/explicit-function-return-type': 'warn',
101
-
102
- '@typescript-eslint/explicit-member-accessibility': 'error',
103
-
104
- '@typescript-eslint/member-ordering': 'warn',
105
-
106
- '@typescript-eslint/method-signature-style': 'error',
107
-
108
- '@typescript-eslint/no-empty-interface': 'off',
109
-
110
- 'brace-style': 'off',
111
-
112
- '@typescript-eslint/brace-style': ['error'],
113
-
114
- curly: 'error',
115
-
116
- camelcase: 'off',
117
-
118
- 'no-lonely-if': 'error',
119
-
120
- '@typescript-eslint/naming-convention': namingConventions,
121
-
122
- '@typescript-eslint/no-base-to-string': 'warn',
123
-
124
- '@typescript-eslint/no-confusing-non-null-assertion': 'error',
125
-
126
- '@typescript-eslint/no-extraneous-class': 'warn',
127
-
128
- '@typescript-eslint/no-throw-literal': 'error',
129
-
130
- '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
131
-
132
- '@typescript-eslint/no-unnecessary-condition': 'error',
133
-
134
- '@typescript-eslint/no-unnecessary-type-arguments': 'warn',
135
-
136
- '@typescript-eslint/prefer-literal-enum-member': 'error',
137
-
138
- '@typescript-eslint/prefer-nullish-coalescing': 'warn',
139
-
140
- '@typescript-eslint/prefer-optional-chain': 'warn',
141
-
142
- '@typescript-eslint/prefer-readonly': 'error',
143
-
144
- '@typescript-eslint/prefer-string-starts-ends-with': 'error',
145
-
146
- '@typescript-eslint/promise-function-async': 'error',
147
-
148
- '@typescript-eslint/require-array-sort-compare': 'warn',
149
-
150
- '@typescript-eslint/strict-boolean-expressions': 'warn',
151
-
152
- '@typescript-eslint/switch-exhaustiveness-check': 'error',
153
-
154
- '@typescript-eslint/no-magic-numbers': [
155
- 'error',
156
- {
157
- ignoreArrayIndexes: true,
158
- ignore: [1, 0],
159
- ignoreNumericLiteralTypes: true,
160
- },
161
- ],
162
-
163
- '@typescript-eslint/default-param-last': 'error',
164
-
165
- '@typescript-eslint/no-dupe-class-members': 'error',
166
-
167
- '@typescript-eslint/no-unused-expressions': 'error',
168
-
169
- '@typescript-eslint/no-unused-vars': [
170
- 'warn',
171
- { ignoreRestSiblings: true },
172
- ],
173
-
174
- '@typescript-eslint/return-await': 'error',
175
-
176
- 'import/order': 'error',
177
-
178
- 'import/first': 'error',
179
-
180
- 'import/exports-last': 'error',
181
-
182
- 'import/newline-after-import': 'error',
183
- },
184
- };