| 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 | 'axios', |
| 36 | 'benoit', |
| 37 | 'browserslist', |
| 38 | 'builtins', |
| 39 | 'christopher', |
| 40 | 'cjs', |
| 41 | 'cloneable', |
| 42 | 'comparator', |
| 43 | 'cpu', |
| 44 | 'cpus', |
| 45 | 'cryptographically', |
| 46 | 'ctx', |
| 47 | 'deprecations', |
| 48 | 'deque', |
| 49 | 'dequeue', |
| 50 | 'dequeued', |
| 51 | 'deregisters', |
| 52 | 'dts', |
| 53 | 'ecma', |
| 54 | 'elu', |
| 55 | 'enqueue', |
| 56 | 'enum', |
| 57 | 'errored', |
| 58 | 'esm', |
| 59 | 'fastify', |
| 60 | 'fibonacci', |
| 61 | 'fp', |
| 62 | 'fs', |
| 63 | 'func', |
| 64 | 'inheritDoc', |
| 65 | 'javascript', |
| 66 | 'jsdoc', |
| 67 | 'linebreak', |
| 68 | 'localhost', |
| 69 | 'microjob', |
| 70 | 'mjs', |
| 71 | 'nodemailer', |
| 72 | 'npx', |
| 73 | 'num', |
| 74 | 'os', |
| 75 | 'perf', |
| 76 | 'piscina', |
| 77 | 'pnpm', |
| 78 | 'poolifier', |
| 79 | 'prepend', |
| 80 | 'prepends', |
| 81 | 'readdir', |
| 82 | 'readonly', |
| 83 | 'req', |
| 84 | 'resize', |
| 85 | 'sinon', |
| 86 | 'smtp', |
| 87 | 'threadjs', |
| 88 | 'threadwork', |
| 89 | 'tinypool', |
| 90 | 'tsconfig', |
| 91 | 'tsdoc', |
| 92 | 'typedoc', |
| 93 | 'unlink', |
| 94 | 'unref', |
| 95 | 'utf8', |
| 96 | 'workerpool', |
| 97 | 'ws', |
| 98 | 'wss', |
| 99 | 'wwr' |
| 100 | ], |
| 101 | skipIfMatch: ['^@.*', '^plugin:.*'] |
| 102 | } |
| 103 | ] |
| 104 | }, |
| 105 | overrides: [ |
| 106 | { |
| 107 | files: ['**/*.ts'], |
| 108 | plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'], |
| 109 | parser: '@typescript-eslint/parser', |
| 110 | parserOptions: { |
| 111 | project: './tsconfig.json' |
| 112 | }, |
| 113 | extends: [ |
| 114 | 'plugin:@typescript-eslint/strict-type-checked', |
| 115 | 'plugin:@typescript-eslint/stylistic-type-checked', |
| 116 | 'plugin:import/typescript', |
| 117 | 'love' |
| 118 | ], |
| 119 | rules: { |
| 120 | 'operator-linebreak': 'off', |
| 121 | 'tsdoc/syntax': 'warn' |
| 122 | } |
| 123 | }, |
| 124 | { |
| 125 | files: ['examples/typescript/**/*.ts'], |
| 126 | rules: { |
| 127 | 'import/no-unresolved': [ |
| 128 | 'error', |
| 129 | { |
| 130 | ignore: [ |
| 131 | '^axios$', |
| 132 | '^express$', |
| 133 | '^fastify$', |
| 134 | '^fastify-plugin$', |
| 135 | '^node-fetch$', |
| 136 | '^nodemailer$', |
| 137 | '^poolifier$', |
| 138 | '^ws$' |
| 139 | ] |
| 140 | } |
| 141 | ], |
| 142 | '@typescript-eslint/no-unsafe-argument': 'off', |
| 143 | '@typescript-eslint/no-unsafe-call': 'off', |
| 144 | '@typescript-eslint/no-unsafe-return': 'off', |
| 145 | '@typescript-eslint/no-unsafe-assignment': 'off', |
| 146 | '@typescript-eslint/no-unsafe-member-access': 'off', |
| 147 | '@typescript-eslint/no-unnecessary-type-assertion': 'off', |
| 148 | '@typescript-eslint/no-redundant-type-constituents': 'off', |
| 149 | '@typescript-eslint/strict-boolean-expressions': 'off', |
| 150 | '@typescript-eslint/return-await': 'off', |
| 151 | '@typescript-eslint/no-non-null-assertion': 'off' |
| 152 | } |
| 153 | }, |
| 154 | { |
| 155 | files: ['**/*.cjs', '**/*.js', '**/*.mjs'], |
| 156 | plugins: ['jsdoc'], |
| 157 | extends: ['plugin:n/recommended', 'plugin:jsdoc/recommended', 'standard'] |
| 158 | }, |
| 159 | { |
| 160 | files: ['tests/**/*.cjs', 'tests/**/*.js', 'tests/**/*.mjs'], |
| 161 | rules: { |
| 162 | 'jsdoc/require-jsdoc': 'off' |
| 163 | } |
| 164 | }, |
| 165 | { |
| 166 | files: [ |
| 167 | 'benchmarks/**/*.cjs', |
| 168 | 'benchmarks/**/*.js', |
| 169 | 'benchmarks/**/*.mjs' |
| 170 | ], |
| 171 | rules: { |
| 172 | 'jsdoc/require-jsdoc': 'off' |
| 173 | } |
| 174 | }, |
| 175 | { |
| 176 | files: ['examples/javascript/**/*.cjs', 'examples/javascript/**/*.js'], |
| 177 | rules: { |
| 178 | 'jsdoc/require-jsdoc': 'off' |
| 179 | } |
| 180 | } |
| 181 | ] |
| 182 | }) |