| 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 | ecmaVersion: 2022, |
| 12 | sourceType: 'module' |
| 13 | }, |
| 14 | plugins: ['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 | 'sort-imports': [ |
| 29 | 'error', |
| 30 | { |
| 31 | ignoreDeclarationSort: true |
| 32 | } |
| 33 | ], |
| 34 | 'import/order': 'error', |
| 35 | |
| 36 | 'spellcheck/spell-checker': [ |
| 37 | 'warn', |
| 38 | { |
| 39 | skipWords: [ |
| 40 | 'axios', |
| 41 | 'benoit', |
| 42 | 'browserslist', |
| 43 | 'builtins', |
| 44 | 'christopher', |
| 45 | 'cjs', |
| 46 | 'cloneable', |
| 47 | 'comparator', |
| 48 | 'cpu', |
| 49 | 'cpus', |
| 50 | 'cryptographically', |
| 51 | 'ctx', |
| 52 | 'deprecations', |
| 53 | 'deque', |
| 54 | 'dequeue', |
| 55 | 'dequeued', |
| 56 | 'deregisters', |
| 57 | 'dts', |
| 58 | 'ecma', |
| 59 | 'elu', |
| 60 | 'enqueue', |
| 61 | 'enum', |
| 62 | 'errored', |
| 63 | 'esm', |
| 64 | 'fastify', |
| 65 | 'fibonacci', |
| 66 | 'fp', |
| 67 | 'fs', |
| 68 | 'func', |
| 69 | 'inheritDoc', |
| 70 | 'javascript', |
| 71 | 'jsdoc', |
| 72 | 'localhost', |
| 73 | 'microjob', |
| 74 | 'mjs', |
| 75 | 'nodemailer', |
| 76 | 'npx', |
| 77 | 'num', |
| 78 | 'os', |
| 79 | 'perf', |
| 80 | 'piscina', |
| 81 | 'pnpm', |
| 82 | 'poolifier', |
| 83 | 'prepend', |
| 84 | 'prepends', |
| 85 | 'readdir', |
| 86 | 'readonly', |
| 87 | 'req', |
| 88 | 'resize', |
| 89 | 'sinon', |
| 90 | 'smtp', |
| 91 | 'threadjs', |
| 92 | 'threadwork', |
| 93 | 'tinypool', |
| 94 | 'tsconfig', |
| 95 | 'tsdoc', |
| 96 | 'typedoc', |
| 97 | 'unlink', |
| 98 | 'unref', |
| 99 | 'utf8', |
| 100 | 'webcrypto', |
| 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/recommended', |
| 120 | 'plugin:@typescript-eslint/recommended-requiring-type-checking', |
| 121 | 'plugin:import/typescript', |
| 122 | 'standard-with-typescript' |
| 123 | ], |
| 124 | rules: { |
| 125 | '@typescript-eslint/no-inferrable-types': [ |
| 126 | 'error', |
| 127 | { ignoreProperties: true } |
| 128 | ], |
| 129 | 'tsdoc/syntax': 'warn' |
| 130 | } |
| 131 | }, |
| 132 | { |
| 133 | files: ['examples/typescript/**/*.ts'], |
| 134 | rules: { |
| 135 | 'import/no-unresolved': [ |
| 136 | 'error', |
| 137 | { |
| 138 | ignore: [ |
| 139 | '^axios$', |
| 140 | '^express$', |
| 141 | '^fastify$', |
| 142 | '^fastify-plugin$', |
| 143 | '^node-fetch$', |
| 144 | '^nodemailer$', |
| 145 | '^poolifier$', |
| 146 | '^ws$' |
| 147 | ] |
| 148 | } |
| 149 | ], |
| 150 | '@typescript-eslint/no-unsafe-argument': 'off', |
| 151 | '@typescript-eslint/no-unsafe-call': 'off', |
| 152 | '@typescript-eslint/no-unsafe-return': 'off', |
| 153 | '@typescript-eslint/no-unsafe-assignment': 'off', |
| 154 | '@typescript-eslint/no-unsafe-member-access': 'off', |
| 155 | '@typescript-eslint/no-unnecessary-type-assertion': 'off', |
| 156 | '@typescript-eslint/no-redundant-type-constituents': 'off', |
| 157 | '@typescript-eslint/strict-boolean-expressions': 'off', |
| 158 | '@typescript-eslint/return-await': 'off' |
| 159 | } |
| 160 | }, |
| 161 | { |
| 162 | files: ['**/*.js', '**/*.mjs'], |
| 163 | plugins: ['jsdoc'], |
| 164 | extends: ['plugin:n/recommended', 'plugin:jsdoc/recommended', 'standard'] |
| 165 | }, |
| 166 | { |
| 167 | files: ['tests/**/*.js', 'tests/**/*.mjs'], |
| 168 | rules: { |
| 169 | 'jsdoc/require-jsdoc': 'off' |
| 170 | } |
| 171 | }, |
| 172 | { |
| 173 | files: ['benchmarks/**/*.js', 'benchmarks/**/*.mjs'], |
| 174 | rules: { |
| 175 | 'jsdoc/require-jsdoc': 'off' |
| 176 | } |
| 177 | }, |
| 178 | { |
| 179 | files: ['examples/javascript/**/*.js'], |
| 180 | rules: { |
| 181 | 'jsdoc/require-jsdoc': 'off' |
| 182 | } |
| 183 | } |
| 184 | ] |
| 185 | }) |