|
2 | 2 |
|
3 | 3 | const path = require('node:path')
|
4 | 4 |
|
5 |
| -const eslintPluginUnicorn = require('eslint-plugin-unicorn') |
6 | 5 | const { includeIgnoreFile } = require('@eslint/compat')
|
7 | 6 | const js = require('@eslint/js')
|
8 | 7 | const nodePlugin = require('eslint-plugin-n')
|
| 8 | +const sortDestructureKeysPlugin = require('eslint-plugin-sort-destructure-keys') |
| 9 | +const unicornPlugin = require('eslint-plugin-unicorn') |
9 | 10 | const tsEslint = require('typescript-eslint')
|
10 | 11 | const tsParser = require('@typescript-eslint/parser')
|
11 | 12 |
|
12 | 13 | const gitignorePath = path.resolve(__dirname, '.gitignore')
|
13 | 14 | const prettierignorePath = path.resolve(__dirname, '.prettierignore')
|
14 | 15 |
|
15 | 16 | const sharedPlugins = {
|
16 |
| - unicorn: eslintPluginUnicorn |
| 17 | + 'sort-destructure-keys': sortDestructureKeysPlugin, |
| 18 | + unicorn: unicornPlugin |
17 | 19 | }
|
18 | 20 |
|
19 | 21 | const sharedRules = {
|
20 | 22 | 'no-await-in-loop': ['error'],
|
21 |
| - 'no-empty': ['error', { allowEmptyCatch: true }], |
22 | 23 | 'no-control-regex': ['error'],
|
| 24 | + 'no-empty': ['error', { allowEmptyCatch: true }], |
23 | 25 | 'no-new': ['error'],
|
| 26 | + 'no-proto': ['error'], |
24 | 27 | 'no-warning-comments': ['warn', { terms: ['fixme'] }],
|
| 28 | + 'sort-destructure-keys/sort-destructure-keys': ['error'], |
| 29 | + 'sort-imports': ['error', { ignoreDeclarationSort: true }], |
25 | 30 | 'unicorn/consistent-function-scoping': ['error']
|
26 | 31 | }
|
27 | 32 |
|
@@ -49,6 +54,10 @@ module.exports = [
|
49 | 54 | },
|
50 | 55 | rules: {
|
51 | 56 | ...sharedRules,
|
| 57 | + // Define @typescript-eslint/no-extraneous-class because oxlint defines |
| 58 | + // "no-extraneous-class": ["deny"] and trying to eslint-disable it will |
| 59 | + // cause an eslint "Definition not found" error otherwise. |
| 60 | + '@typescript-eslint/no-extraneous-class': ['error'], |
52 | 61 | '@typescript-eslint/no-floating-promises': ['error'],
|
53 | 62 | // Define @typescript-eslint/no-misused-new because oxlint defines
|
54 | 63 | // "no-misused-new": ["deny"] and trying to eslint-disable it will
|
@@ -88,6 +97,15 @@ module.exports = [
|
88 | 97 | rules: {
|
89 | 98 | ...js.configs.recommended.rules,
|
90 | 99 | ...sharedRules,
|
| 100 | + 'n/exports-style': ['error', 'module.exports'], |
| 101 | + // The n/no-unpublished-bin rule does does not support non-trivial glob |
| 102 | + // patterns used in package.json "files" fields. In those cases we simplify |
| 103 | + // the glob patterns used. |
| 104 | + 'n/no-unpublished-bin': ['error'], |
| 105 | + 'n/no-unsupported-features/es-builtins': ['error'], |
| 106 | + 'n/no-unsupported-features/es-syntax': ['error'], |
| 107 | + 'n/no-unsupported-features/node-builtins': ['error'], |
| 108 | + 'n/prefer-node-protocol': ['error'], |
91 | 109 | 'no-unused-vars': [
|
92 | 110 | 'error',
|
93 | 111 | { argsIgnorePattern: '^_|^this$', ignoreRestSiblings: true }
|
|
0 commit comments