| 1 | const { defineConfig } = require('eslint-define-config') |
| 2 | |
| 3 | module.exports = defineConfig({ |
| 4 | root: true, |
| 5 | env: { |
| 6 | es2022: true, |
| 7 | node: true, |
| 8 | mocha: true |
| 9 | }, |
| 10 | parserOptions: { |
| 11 | sourceType: 'module', |
| 12 | ecmaVersion: 2022 |
| 13 | }, |
| 14 | plugins: ['simple-import-sort', 'promise', 'spellcheck'], |
| 15 | extends: [ |
| 16 | 'eslint:recommended', |
| 17 | 'plugin:import/recommended', |
| 18 | 'plugin:promise/recommended' |
| 19 | ], |
| 20 | settings: { |
| 21 | 'import/resolver': { |
| 22 | typescript: { |
| 23 | project: './tsconfig.json' |
| 24 | } |
| 25 | } |
| 26 | }, |
| 27 | rules: { |
| 28 | 'simple-import-sort/imports': 'error', |
| 29 | 'simple-import-sort/exports': 'error', |
| 30 | |
| 31 | 'spellcheck/spell-checker': [ |
| 32 | 'warn', |
| 33 | { |
| 34 | skipWords: [ |
| 35 | 'argv', |
| 36 | 'axios', |
| 37 | 'benoit', |
| 38 | 'browserslist', |
| 39 | 'builtins', |
| 40 | 'christopher', |
| 41 | 'cjs', |
| 42 | 'cloneable', |
| 43 | 'comparator', |
| 44 | 'cpu', |
| 45 | 'cpus', |
| 46 | 'cryptographically', |
| 47 | 'ctx', |
| 48 | 'deprecations', |
| 49 | 'deque', |
| 50 | 'dequeue', |
| 51 | 'dequeued', |
| 52 | 'deregisters', |
| 53 | 'dts', |
| 54 | 'ecma', |
| 55 | 'elu', |
| 56 | 'enqueue', |
| 57 | 'enum', |
| 58 | 'errored', |
| 59 | 'esm', |
| 60 | 'fastify', |
| 61 | 'fibonacci', |
| 62 | 'fp', |
| 63 | 'fs', |
| 64 | 'func', |
| 65 | 'inheritDoc', |
| 66 | 'javascript', |
| 67 | 'jsdoc', |
| 68 | 'linebreak', |
| 69 | 'localhost', |
| 70 | 'microjob', |
| 71 | 'mitata', |
| 72 | 'mjs', |
| 73 | 'nodemailer', |
| 74 | 'npx', |
| 75 | 'num', |
| 76 | 'os', |
| 77 | 'perf', |
| 78 | 'piscina', |
| 79 | 'pnpm', |
| 80 | 'poolifier', |
| 81 | 'prepend', |
| 82 | 'prepends', |
| 83 | 'positionals', |
| 84 | 'readdir', |
| 85 | 'readonly', |
| 86 | 'req', |
| 87 | 'resize', |
| 88 | 'sinon', |
| 89 | 'smtp', |
| 90 | 'threadjs', |
| 91 | 'threadwork', |
| 92 | 'tinypool', |
| 93 | 'tld', |
| 94 | 'tos', |
| 95 | 'tsconfig', |
| 96 | 'tsdoc', |
| 97 | 'typedoc', |
| 98 | 'unlink', |
| 99 | 'unref', |
| 100 | 'utf8', |
| 101 | 'workerpool', |
| 102 | 'ws', |
| 103 | 'wss', |
| 104 | 'wwr' |
| 105 | ], |
| 106 | skipIfMatch: ['^@.*', '^plugin:.*'] |
| 107 | } |
| 108 | ] |
| 109 | }, |
| 110 | overrides: [ |
| 111 | { |
| 112 | files: ['**/*.ts'], |
| 113 | plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'], |
| 114 | parser: '@typescript-eslint/parser', |
| 115 | parserOptions: { |
| 116 | project: './tsconfig.json' |
| 117 | }, |
| 118 | extends: [ |
| 119 | 'plugin:@typescript-eslint/strict-type-checked', |
| 120 | 'plugin:@typescript-eslint/stylistic-type-checked', |
| 121 | 'plugin:import/typescript', |
| 122 | 'love' |
| 123 | ], |
| 124 | rules: { |
| 125 | 'operator-linebreak': 'off', |
| 126 | 'tsdoc/syntax': 'warn' |
| 127 | } |
| 128 | }, |
| 129 | { |
| 130 | files: ['examples/typescript/**/*.ts'], |
| 131 | rules: { |
| 132 | 'import/no-unresolved': [ |
| 133 | 'error', |
| 134 | { |
| 135 | ignore: [ |
| 136 | '^axios$', |
| 137 | '^express$', |
| 138 | '^fastify$', |
| 139 | '^fastify-plugin$', |
| 140 | '^node-fetch$', |
| 141 | '^nodemailer$', |
| 142 | '^poolifier$', |
| 143 | '^ws$' |
| 144 | ] |
| 145 | } |
| 146 | ], |
| 147 | '@typescript-eslint/no-unsafe-argument': 'off', |
| 148 | '@typescript-eslint/no-unsafe-call': 'off', |
| 149 | '@typescript-eslint/no-unsafe-return': 'off', |
| 150 | '@typescript-eslint/no-unsafe-assignment': 'off', |
| 151 | '@typescript-eslint/no-unsafe-member-access': 'off', |
| 152 | '@typescript-eslint/no-unnecessary-type-assertion': 'off', |
| 153 | '@typescript-eslint/no-redundant-type-constituents': 'off', |
| 154 | '@typescript-eslint/strict-boolean-expressions': 'off', |
| 155 | '@typescript-eslint/return-await': 'off', |
| 156 | '@typescript-eslint/no-non-null-assertion': 'off' |
| 157 | } |
| 158 | }, |
| 159 | { |
| 160 | files: ['**/*.cjs', '**/*.js', '**/*.mjs'], |
| 161 | plugins: ['jsdoc'], |
| 162 | extends: ['plugin:n/recommended', 'plugin:jsdoc/recommended', 'standard'] |
| 163 | }, |
| 164 | { |
| 165 | files: ['tests/**/*.cjs', 'tests/**/*.js', 'tests/**/*.mjs'], |
| 166 | rules: { |
| 167 | 'jsdoc/require-jsdoc': 'off' |
| 168 | } |
| 169 | }, |
| 170 | { |
| 171 | files: [ |
| 172 | 'benchmarks/**/*.cjs', |
| 173 | 'benchmarks/**/*.js', |
| 174 | 'benchmarks/**/*.mjs' |
| 175 | ], |
| 176 | rules: { |
| 177 | 'jsdoc/require-jsdoc': 'off' |
| 178 | } |
| 179 | }, |
| 180 | { |
| 181 | files: ['examples/javascript/**/*.cjs', 'examples/javascript/**/*.js'], |
| 182 | rules: { |
| 183 | 'jsdoc/require-jsdoc': 'off' |
| 184 | } |
| 185 | } |
| 186 | ] |
| 187 | }) |