GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — node/test/eslint.config_partial.mjs at main · Tobbe/node Expand file tree/ Copy patheslint.config_partial.mjsMore file actions 230 lines (226 loc) · 11.4 KB / Copy patheslint.config_partial.mjsFile metadata and controls230 lines (226 loc) · 11.4 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 /* eslint-disable @stylistic/js/max-len */ import { globals, noRestrictedSyntaxCommonAll, } from '../tools/eslint/eslint.config_utils.mjs'; export default [ { files: ['test/**/*.{js,mjs,cjs}'], languageOptions: { globals: { ...globals.node, CloseEvent: true, ErrorEvent: true, }, }, rules: { 'multiline-comment-style': [ 'error', 'separate-lines', ], 'prefer-const': 'error', 'symbol-description': 'off', 'no-restricted-syntax': [ 'error', ...noRestrictedSyntaxCommonAll, { selector: "CallExpression:matches([callee.name='deepStrictEqual'], [callee.property.name='deepStrictEqual']):matches([arguments.1.type='Literal']:not([arguments.1.regex]), [arguments.1.type='Identifier'][arguments.1.name='undefined'])", message: 'Use strictEqual instead of deepStrictEqual for literals or undefined.', }, { selector: "CallExpression:matches([callee.name='notDeepStrictEqual'], [callee.property.name='notDeepStrictEqual']):matches([arguments.1.type='Literal']:not([arguments.1.regex]), [arguments.1.type='Identifier'][arguments.1.name='undefined'])", message: 'Use notStrictEqual instead of notDeepStrictEqual for literals or undefined.', }, { selector: "CallExpression:matches([callee.name='deepStrictEqual'], [callee.property.name='deepStrictEqual'])[arguments.2.type='Literal']", message: 'Do not use a literal for the third argument of assert.deepStrictEqual()', }, { selector: "CallExpression:matches([callee.name='notDeepStrictEqual'], [callee.property.name='deepStrictEqual'])[arguments.2.type='Literal']", message: 'Do not use a literal for the third argument of assert.notDeepStrictEqual()', }, { selector: "CallExpression:matches([callee.name='doesNotThrow'], [callee.property.name='doesNotThrow'])", message: 'Do not use `assert.doesNotThrow()`. Write the code without the wrapper and add a comment instead.', }, { selector: "CallExpression:matches([callee.name='doesNotReject'], [callee.property.name='doesNotReject'])", message: 'Do not use `assert.doesNotReject()`. Write the code without the wrapper and add a comment instead.', }, { selector: "CallExpression:matches([callee.name='rejects'], [callee.property.name='rejects'])[arguments.length<2]", message: '`assert.rejects()` must be invoked with at least two arguments.', }, { selector: "CallExpression[callee.property.name='notStrictEqual'][arguments.2.type='Literal']", message: 'Do not use a literal for the third argument of assert.notStrictEqual()', }, { selector: "CallExpression[callee.property.name='strictEqual'][arguments.2.type='Literal']", message: 'Do not use a literal for the third argument of assert.strictEqual()', }, { selector: "CallExpression[callee.name='assert'][arguments.1.type='Literal']:not([arguments.1.raw=/['\"`].*/])", message: 'Do not use a non-string literal for the second argument of assert()', }, { selector: "CallExpression:matches([callee.name='throws'], [callee.property.name='throws'])[arguments.1.type='Literal']:not([arguments.1.regex])", message: 'Use an object as second argument of `assert.throws()`.', }, { selector: "CallExpression:matches([callee.name='throws'], [callee.property.name='throws'])[arguments.length<2]", message: '`assert.throws()` must be invoked with at least two arguments.', }, { selector: "CallExpression:matches([callee.name='notDeepStrictEqual'], [callee.property.name='notDeepStrictEqual'])[arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression']):not([arguments.1.type='UnaryExpression'])", message: 'The first argument should be the `actual`, not the `expected` value.', }, { selector: "CallExpression:matches([callee.name='notStrictEqual'], [callee.property.name='notStrictEqual'])[arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression']):not([arguments.1.type='UnaryExpression'])", message: 'The first argument should be the `actual`, not the `expected` value.', }, { selector: "CallExpression:matches([callee.name='deepStrictEqual'], [callee.property.name='deepStrictEqual'])[arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression']):not([arguments.1.type='UnaryExpression'])", message: 'The first argument should be the `actual`, not the `expected` value.', }, { selector: "CallExpression:matches([callee.name='strictEqual'], [callee.property.name='strictEqual'])[arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression']):not([arguments.1.type='UnaryExpression'])", message: 'The first argument should be the `actual`, not the `expected` value.', }, { selector: "CallExpression[callee.name='isNaN']", message: 'Use `Number.isNaN()` instead of the global `isNaN()` function.', }, { selector: "VariableDeclarator > CallExpression:matches([callee.name='debuglog'], [callee.property.name='debuglog']):not([arguments.0.value='test'])", message: "Use 'test' as debuglog value in tests.", }, { selector: 'CallExpression:matches([callee.object.name="common"][callee.property.name=/^must(Not)?Call/],[callee.name="mustCall"],[callee.name="mustCallAtLeast"],[callee.name="mustNotCall"])>:first-child[type=/FunctionExpression$/][body.body.length=0]', message: 'Do not use an empty function, omit the parameter altogether.', }, { selector: "ExpressionStatement>CallExpression:matches([callee.name='rejects'], [callee.object.name='assert'][callee.property.name='rejects'])", message: 'Calling `assert.rejects` without `await` or `.then(common.mustCall())` will not detect never-settling promises.', }, { selector: 'CallExpression[callee.property.name="catch"]>:first-child:matches(CallExpression[callee.object.name="common"][callee.property.name="mustNotCall"], CallExpression[callee.name="mustNotCall"])', message: 'Calling `.catch(common.mustNotCall())` will not detect never-settling promises. Use `.then(common.mustCall())` instead.', }, { selector: 'CallExpression:matches([callee.type="Identifier"][callee.name="assert"], [callee.type="MemberExpression"][callee.object.type="Identifier"][callee.object.name="assert"][callee.property.type="Identifier"][callee.property.name="ok"])[arguments.0.type="CallExpression"][arguments.0.callee.type="MemberExpression"][arguments.0.callee.object.regex][arguments.0.callee.property.type="Identifier"][arguments.0.callee.property.name="test"]', message: 'Use assert.match instead', }, { selector: 'CallExpression:matches([callee.type="Identifier"][callee.name="assert"], [callee.type="MemberExpression"][callee.object.type="Identifier"][callee.object.name="assert"][callee.property.type="Identifier"][callee.property.name="ok"])[arguments.0.type="UnaryExpression"][arguments.0.operator="!"][arguments.0.argument.type="CallExpression"][arguments.0.argument.callee.type="MemberExpression"][arguments.0.argument.callee.object.regex][arguments.0.argument.callee.property.name="test"]', message: 'Use assert.doesNotMatch instead', }, { selector: 'VariableDeclarator[init.type="Identifier"][init.name=/^(assert|fixtures)$/]', message: 'Do not destructure or rename `assert` nor `fixtures`', }, ...((fixturesSpecifier) => [ { selector: `ImportDeclaration[source.value=${fixturesSpecifier.toString().replace('(\\.js)?', '\\.mjs')}]:not(${[ 'length=1', '0.type="ImportNamespaceSpecifier"', ].map((selector) => `[specifiers.${selector}]`).join('')})`, message: 'Do not use named imports, use `import * as fixtures from` instead', }, { selector: `ImportDeclaration[source.value=${fixturesSpecifier}]:not(${[ 'length=1', '0.type="ImportDefaultSpecifier"', ].map((selector) => `[specifiers.${selector}]`).join('')})`, message: 'Do not use named imports, use `import fixtures from` instead', }, { selector: `:not(VariableDeclarator[id.type="Identifier"])>CallExpression[callee.name="require"][arguments.0.value=${fixturesSpecifier}]`, message: 'Do not destructure, use `const fixtures =` instead', }, ])(/^(\.\.\u002f)+common\u002ffixtures(\.js)?$/), ], // Stylistic rules. '@stylistic/js/comma-dangle': [ 'error', 'always-multiline', ], // Custom rules in tools/eslint-rules. 'node-core/prefer-assert-iferror': 'error', 'node-core/prefer-assert-methods': 'error', 'node-core/prefer-common-mustnotcall': 'error', 'node-core/prefer-common-mustsucceed': 'error', 'node-core/crypto-check': 'error', 'node-core/eslint-check': 'error', 'node-core/async-iife-no-unused-result': 'error', 'node-core/inspector-check': 'error', // `common` module is mandatory in tests. 'node-core/required-modules': [ 'error', { common: 'common(/index\\.(m)?js)?$' }, ], 'node-core/require-common-first': 'error', 'node-core/no-duplicate-requires': 'off', 'node-core/must-call-assert': 'error', 'node-core/prefer-abort-signal-abort': 'error', }, }, { files: [ 'test/parallel/**/*.{js,mjs}', ], rules: { '@stylistic/js/comma-dangle': [ 'error', { arrays: 'always-multiline', exports: 'always-multiline', functions: 'only-multiline', imports: 'always-multiline', objects: 'only-multiline', }, ], }, }, { files: [ 'test/es-module/**/*.{js,mjs}', 'test/sequential/**/*.{js,mjs}', ], rules: { '@stylistic/js/comma-dangle': [ 'error', { arrays: 'always-multiline', exports: 'always-multiline', functions: 'only-multiline', imports: 'always-multiline', objects: 'always-multiline', }, ], }, }, { files: [ 'test/{common,fixtures,wpt}/**/*.{js,mjs,cjs}', 'test/eslint.config_partial.mjs', ], rules: { 'node-core/required-modules': 'off', 'node-core/require-common-first': 'off', 'node-core/must-call-assert': 'off', }, }, { files: [ 'test/es-module/test-esm-example-loader.js', 'test/es-module/test-esm-type-flag.js', 'test/es-module/test-esm-type-flag-alias.js', 'test/es-module/test-require-module-detect-entry-point.js', 'test/es-module/test-require-module-detect-entry-point-aou.js', ], languageOptions: { sourceType: 'module', }, }, ]; |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |