|
1 | | -const eslint = require('@eslint/js'); |
2 | | -const tseslint = require('typescript-eslint'); |
3 | | -const tsdoc = require('eslint-plugin-tsdoc'); |
4 | | -const jest = require('eslint-plugin-jest'); |
5 | | -const globals = require('globals'); |
6 | | -const prettier = require('eslint-config-prettier'); |
| 1 | +const eslint = require("@eslint/js"); |
| 2 | +const tseslint = require("typescript-eslint"); |
| 3 | +const tsdoc = require("eslint-plugin-tsdoc"); |
| 4 | +const jest = require("eslint-plugin-jest"); |
| 5 | +const globals = require("globals"); |
| 6 | +const prettier = require("eslint-config-prettier"); |
7 | 7 |
|
8 | | -/** @type {import('eslint').Linter.Config[]} */ |
| 8 | +/** @type {import("eslint").Linter.Config[]} */ |
9 | 9 | module.exports = [ |
10 | 10 | { |
11 | | - ignores: ['dist/', 'tests/env/', 'coverage/', 'playgrounds/', 'docs/'], |
| 11 | + ignores: ["dist/", "tests/env/", "coverage/", "playgrounds/", "docs/"], |
12 | 12 | }, |
13 | 13 | // Standard linting for js files |
14 | 14 | { |
15 | | - files: ['**/*.js'], |
16 | | - languageOptions: { sourceType: 'script', globals: globals.node }, |
| 15 | + files: ["**/*.js"], |
| 16 | + languageOptions: { sourceType: "script", globals: globals.node }, |
17 | 17 | plugins: { eslint }, |
18 | 18 | rules: eslint.configs.recommended.rules, |
19 | 19 | }, |
20 | 20 | // TypeScript linting for ts files |
21 | 21 | ...tseslint.configs.recommendedTypeChecked.map((config) => ({ |
22 | 22 | ...config, |
23 | | - files: ['**/*.ts'], |
| 23 | + files: ["**/*.ts"], |
24 | 24 | languageOptions: { |
25 | 25 | globals: globals.node, |
26 | 26 | parser: tseslint.parser, |
27 | | - parserOptions: { project: 'tsconfig.eslint.json' }, |
| 27 | + parserOptions: { project: "tsconfig.eslint.json" }, |
28 | 28 | }, |
29 | 29 | plugins: { ...config.plugins, tsdoc }, |
30 | 30 | rules: { |
31 | 31 | ...config.rules, |
32 | | - 'tsdoc/syntax': 'error', |
| 32 | + "tsdoc/syntax": "error", |
33 | 33 | // @TODO: Remove the ones between "~~", adapt code |
34 | 34 | // ~~ |
35 | | - '@typescript-eslint/prefer-as-const': 'off', |
36 | | - '@typescript-eslint/ban-ts-comment': 'off', |
37 | | - '@typescript-eslint/no-unsafe-call': 'off', |
38 | | - '@typescript-eslint/no-unsafe-member-access': 'off', |
39 | | - '@typescript-eslint/no-unsafe-return': 'off', |
40 | | - '@typescript-eslint/no-unsafe-assignment': 'off', |
41 | | - '@typescript-eslint/no-unsafe-argument': 'off', |
42 | | - '@typescript-eslint/no-floating-promises': 'off', |
| 35 | + "@typescript-eslint/prefer-as-const": "off", |
| 36 | + "@typescript-eslint/ban-ts-comment": "off", |
| 37 | + "@typescript-eslint/no-unsafe-call": "off", |
| 38 | + "@typescript-eslint/no-unsafe-member-access": "off", |
| 39 | + "@typescript-eslint/no-unsafe-return": "off", |
| 40 | + "@typescript-eslint/no-unsafe-assignment": "off", |
| 41 | + "@typescript-eslint/no-unsafe-argument": "off", |
| 42 | + "@typescript-eslint/no-floating-promises": "off", |
43 | 43 | // ~~ |
44 | | - '@typescript-eslint/array-type': ['warn', { default: 'array-simple' }], |
| 44 | + "@typescript-eslint/array-type": ["warn", { default: "array-simple" }], |
45 | 45 | // @TODO: Should be careful with this rule, should leave it be and disable |
46 | 46 | // it within files where necessary with explanations |
47 | | - '@typescript-eslint/no-explicit-any': 'off', |
48 | | - '@typescript-eslint/no-unused-vars': [ |
49 | | - 'error', |
| 47 | + "@typescript-eslint/no-explicit-any": "off", |
| 48 | + "@typescript-eslint/no-unused-vars": [ |
| 49 | + "error", |
50 | 50 | // argsIgnorePattern: https://eslint.org/docs/latest/rules/no-unused-vars#argsignorepattern |
51 | 51 | // varsIgnorePattern: https://eslint.org/docs/latest/rules/no-unused-vars#varsignorepattern |
52 | | - { args: 'all', argsIgnorePattern: '^_', varsIgnorePattern: '^_' }, |
| 52 | + { args: "all", argsIgnorePattern: "^_", varsIgnorePattern: "^_" }, |
53 | 53 | ], |
54 | 54 | // @TODO: Not recommended to disable rule, should instead disable locally |
55 | 55 | // with explanation |
56 | | - '@typescript-eslint/ban-ts-ignore': 'off', |
57 | | - '@typescript-eslint/no-require-imports': 'off', |
| 56 | + "@typescript-eslint/ban-ts-ignore": "off", |
58 | 57 | }, |
59 | 58 | })), |
60 | 59 | // Jest linting for test files |
61 | 60 | { |
62 | | - files: ['tests/*.ts'], |
63 | | - ...jest.configs['flat/recommended'], |
| 61 | + files: ["tests/*.ts"], |
| 62 | + ...jest.configs["flat/recommended"], |
64 | 63 | // languageOptions: { |
65 | 64 | // ...jest.configs['flat/recommended'].languageOptions, |
66 | 65 | // globals: globals.jest, |
67 | 66 | // }, |
68 | 67 | rules: { |
69 | | - ...jest.configs['flat/recommended'].rules, |
| 68 | + ...jest.configs["flat/recommended"].rules, |
70 | 69 | // @TODO: Remove all of these rules and adapt code! |
71 | | - 'jest/no-disabled-tests': 'off', |
72 | | - 'jest/expect-expect': 'off', |
73 | | - 'jest/no-conditional-expect': 'off', |
74 | | - 'jest/valid-title': 'off', |
75 | | - 'jest/no-jasmine-globals': 'off', |
76 | | - 'jest/valid-expect-in-promise': 'off', |
77 | | - 'jest/valid-expect': 'off', |
78 | | - 'jest/no-alias-methods': 'off', |
| 70 | + "jest/no-disabled-tests": "off", |
| 71 | + "jest/expect-expect": "off", |
| 72 | + "jest/no-conditional-expect": "off", |
| 73 | + "jest/valid-title": "off", |
| 74 | + "jest/no-jasmine-globals": "off", |
| 75 | + "jest/valid-expect-in-promise": "off", |
| 76 | + "jest/valid-expect": "off", |
| 77 | + "jest/no-alias-methods": "off", |
79 | 78 | }, |
80 | 79 | }, |
81 | 80 | prettier, |
|
0 commit comments