diff --git a/lib/rules/callback-return.js b/lib/rules/callback-return.js index d4291412..aa2203c3 100644 --- a/lib/rules/callback-return.js +++ b/lib/rules/callback-return.js @@ -6,7 +6,6 @@ module.exports = { meta: { - type: "suggestion", docs: { description: "require `return` statements after callbacks", category: "Stylistic Issues", @@ -14,16 +13,17 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/callback-return.md", }, + fixable: null, + messages: { + missingReturn: "Expected return with your callback function.", + }, schema: [ { type: "array", items: { type: "string" }, }, ], - fixable: null, - messages: { - missingReturn: "Expected return with your callback function.", - }, + type: "suggestion", }, create(context) { diff --git a/lib/rules/exports-style.js b/lib/rules/exports-style.js index 3585d80b..22f56f30 100644 --- a/lib/rules/exports-style.js +++ b/lib/rules/exports-style.js @@ -148,7 +148,6 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/exports-style.md", }, - type: "suggestion", fixable: null, schema: [ { @@ -161,6 +160,7 @@ module.exports = { additionalProperties: false, }, ], + type: "suggestion", }, create(context) { diff --git a/lib/rules/global-require.js b/lib/rules/global-require.js index f7efb608..8f2e0cb8 100644 --- a/lib/rules/global-require.js +++ b/lib/rules/global-require.js @@ -49,7 +49,6 @@ function isShadowed(scope, node) { module.exports = { meta: { - type: "suggestion", docs: { description: "require `require()` calls to be placed at top-level module scope", @@ -59,10 +58,11 @@ module.exports = { "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/global-require.md", }, fixable: null, - schema: [], messages: { unexpected: "Unexpected require().", }, + schema: [], + type: "suggestion", }, create(context) { diff --git a/lib/rules/handle-callback-err.js b/lib/rules/handle-callback-err.js index 5535cd48..e6bc2ffe 100644 --- a/lib/rules/handle-callback-err.js +++ b/lib/rules/handle-callback-err.js @@ -6,7 +6,6 @@ module.exports = { meta: { - type: "suggestion", docs: { description: "require error handling in callbacks", category: "Possible Errors", @@ -15,14 +14,15 @@ module.exports = { "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/handle-callback-err.md", }, fixable: null, + messages: { + expected: "Expected error to be handled.", + }, schema: [ { type: "string", }, ], - messages: { - expected: "Expected error to be handled.", - }, + type: "suggestion", }, create(context) { diff --git a/lib/rules/no-callback-literal.js b/lib/rules/no-callback-literal.js index 75489188..f9091178 100644 --- a/lib/rules/no-callback-literal.js +++ b/lib/rules/no-callback-literal.js @@ -14,9 +14,9 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-callback-literal.md", }, - type: "problem", fixable: null, schema: [], + type: "problem", }, create(context) { diff --git a/lib/rules/no-deprecated-api.js b/lib/rules/no-deprecated-api.js index fbb74bb8..8d8a682c 100644 --- a/lib/rules/no-deprecated-api.js +++ b/lib/rules/no-deprecated-api.js @@ -659,8 +659,8 @@ function toName(type, path) { return type === ReferenceTracker.CALL ? `${baseName}()` : type === ReferenceTracker.CONSTRUCT - ? `new ${baseName}()` - : baseName + ? `new ${baseName}()` + : baseName } /** @@ -688,7 +688,6 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-deprecated-api.md", }, - type: "problem", fixable: null, schema: [ { @@ -720,6 +719,7 @@ module.exports = { additionalProperties: false, }, ], + type: "problem", }, create(context) { const { diff --git a/lib/rules/no-extraneous-import.js b/lib/rules/no-extraneous-import.js index b04f3ec0..cf46bd15 100644 --- a/lib/rules/no-extraneous-import.js +++ b/lib/rules/no-extraneous-import.js @@ -21,7 +21,6 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-extraneous-import.md", }, - type: "problem", fixable: null, schema: [ { @@ -35,6 +34,7 @@ module.exports = { additionalProperties: false, }, ], + type: "problem", }, create(context) { const filePath = context.getFilename() diff --git a/lib/rules/no-extraneous-require.js b/lib/rules/no-extraneous-require.js index bc29c7d8..fc9146ca 100644 --- a/lib/rules/no-extraneous-require.js +++ b/lib/rules/no-extraneous-require.js @@ -21,7 +21,6 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-extraneous-require.md", }, - type: "problem", fixable: null, schema: [ { @@ -35,6 +34,7 @@ module.exports = { additionalProperties: false, }, ], + type: "problem", }, create(context) { const filePath = context.getFilename() diff --git a/lib/rules/no-hide-core-modules.js b/lib/rules/no-hide-core-modules.js index 13f955de..18800b46 100644 --- a/lib/rules/no-hide-core-modules.js +++ b/lib/rules/no-hide-core-modules.js @@ -50,6 +50,7 @@ const BACK_SLASH = /\\/gu module.exports = { meta: { + deprecated: true, docs: { description: "disallow third-party modules which are hiding core modules", @@ -58,8 +59,6 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-hide-core-modules.md", }, - type: "problem", - deprecated: true, fixable: null, schema: [ { @@ -77,6 +76,7 @@ module.exports = { additionalProperties: false, }, ], + type: "problem", }, create(context) { if (context.getFilename() === "") { diff --git a/lib/rules/no-missing-import.js b/lib/rules/no-missing-import.js index 7615e5af..889e592d 100644 --- a/lib/rules/no-missing-import.js +++ b/lib/rules/no-missing-import.js @@ -20,7 +20,6 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-missing-import.md", }, - type: "problem", fixable: null, schema: [ { @@ -33,6 +32,7 @@ module.exports = { additionalProperties: false, }, ], + type: "problem", }, create(context) { const filePath = context.getFilename() diff --git a/lib/rules/no-missing-require.js b/lib/rules/no-missing-require.js index a4bd3f98..3e5db096 100644 --- a/lib/rules/no-missing-require.js +++ b/lib/rules/no-missing-require.js @@ -20,7 +20,6 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-missing-require.md", }, - type: "problem", fixable: null, schema: [ { @@ -33,6 +32,7 @@ module.exports = { additionalProperties: false, }, ], + type: "problem", }, create(context) { const filePath = context.getFilename() diff --git a/lib/rules/no-mixed-requires.js b/lib/rules/no-mixed-requires.js index e8aa5240..3a41ca1d 100644 --- a/lib/rules/no-mixed-requires.js +++ b/lib/rules/no-mixed-requires.js @@ -67,7 +67,6 @@ const BUILTIN_MODULES = [ module.exports = { meta: { - type: "suggestion", docs: { description: "disallow `require` calls to be mixed with regular variable declarations", @@ -77,6 +76,11 @@ module.exports = { "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-mixed-requires.md", }, fixable: null, + messages: { + noMixRequire: "Do not mix 'require' and other declarations.", + noMixCoreModuleFileComputed: + "Do not mix core, module, file and computed requires.", + }, schema: [ { oneOf: [ @@ -98,11 +102,7 @@ module.exports = { ], }, ], - messages: { - noMixRequire: "Do not mix 'require' and other declarations.", - noMixCoreModuleFileComputed: - "Do not mix core, module, file and computed requires.", - }, + type: "suggestion", }, create(context) { diff --git a/lib/rules/no-new-require.js b/lib/rules/no-new-require.js index d758347b..d08ef21a 100644 --- a/lib/rules/no-new-require.js +++ b/lib/rules/no-new-require.js @@ -6,7 +6,6 @@ module.exports = { meta: { - type: "suggestion", docs: { description: "disallow `new` operators with calls to `require`", category: "Possible Errors", @@ -15,10 +14,11 @@ module.exports = { "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-new-require.md", }, fixable: null, - schema: [], messages: { noNewRequire: "Unexpected use of new with require.", }, + schema: [], + type: "suggestion", }, create(context) { diff --git a/lib/rules/no-path-concat.js b/lib/rules/no-path-concat.js index 2b83f74e..c0506d84 100644 --- a/lib/rules/no-path-concat.js +++ b/lib/rules/no-path-concat.js @@ -158,7 +158,6 @@ function isConcat(node, sepNodes, globalScope) { module.exports = { meta: { - type: "suggestion", docs: { description: "disallow string concatenation with `__dirname` and `__filename`", @@ -168,11 +167,12 @@ module.exports = { "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-path-concat.md", }, fixable: null, - schema: [], messages: { usePathFunctions: "Use path.join() or path.resolve() instead of string concatenation.", }, + schema: [], + type: "suggestion", }, create(context) { diff --git a/lib/rules/no-process-env.js b/lib/rules/no-process-env.js index f46f00ec..e2422e32 100644 --- a/lib/rules/no-process-env.js +++ b/lib/rules/no-process-env.js @@ -10,7 +10,6 @@ module.exports = { meta: { - type: "suggestion", docs: { description: "disallow the use of `process.env`", category: "Stylistic Issues", @@ -19,10 +18,11 @@ module.exports = { "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-process-env.md", }, fixable: null, - schema: [], messages: { unexpectedProcessEnv: "Unexpected use of process.env.", }, + schema: [], + type: "suggestion", }, create(context) { diff --git a/lib/rules/no-process-exit.js b/lib/rules/no-process-exit.js index 0dbf02d9..de1dac3f 100644 --- a/lib/rules/no-process-exit.js +++ b/lib/rules/no-process-exit.js @@ -6,7 +6,6 @@ module.exports = { meta: { - type: "suggestion", docs: { description: "disallow the use of `process.exit()`", category: "Possible Errors", @@ -15,10 +14,11 @@ module.exports = { "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-process-exit.md", }, fixable: null, - schema: [], messages: { noProcessExit: "Don't use process.exit(); throw an error instead.", }, + schema: [], + type: "suggestion", }, create(context) { diff --git a/lib/rules/no-restricted-import.js b/lib/rules/no-restricted-import.js index 69eb66d0..a5252515 100644 --- a/lib/rules/no-restricted-import.js +++ b/lib/rules/no-restricted-import.js @@ -9,7 +9,6 @@ const visit = require("../util/visit-import") module.exports = { meta: { - type: "suggestion", docs: { description: "disallow specified modules when loaded by `import` declarations", @@ -19,6 +18,11 @@ module.exports = { "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-restricted-import.md", }, fixable: null, + messages: { + restricted: + // eslint-disable-next-line @mysticatea/eslint-plugin/report-message-format + "'{{name}}' module is restricted from being used.{{customMessage}}", + }, schema: [ { type: "array", @@ -48,11 +52,7 @@ module.exports = { additionalItems: false, }, ], - messages: { - restricted: - // eslint-disable-next-line @mysticatea/eslint-plugin/report-message-format - "'{{name}}' module is restricted from being used.{{customMessage}}", - }, + type: "suggestion", }, create(context) { diff --git a/lib/rules/no-restricted-require.js b/lib/rules/no-restricted-require.js index 959a3941..aa72fc32 100644 --- a/lib/rules/no-restricted-require.js +++ b/lib/rules/no-restricted-require.js @@ -10,7 +10,6 @@ const visit = require("../util/visit-require") module.exports = { meta: { - type: "suggestion", docs: { description: "disallow specified modules when loaded by `require`", category: "Stylistic Issues", @@ -19,6 +18,11 @@ module.exports = { "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-restricted-require.md", }, fixable: null, + messages: { + restricted: + // eslint-disable-next-line @mysticatea/eslint-plugin/report-message-format + "'{{name}}' module is restricted from being used.{{customMessage}}", + }, schema: [ { type: "array", @@ -48,11 +52,7 @@ module.exports = { additionalItems: false, }, ], - messages: { - restricted: - // eslint-disable-next-line @mysticatea/eslint-plugin/report-message-format - "'{{name}}' module is restricted from being used.{{customMessage}}", - }, + type: "suggestion", }, create(context) { diff --git a/lib/rules/no-sync.js b/lib/rules/no-sync.js index ca3a6103..27bcff49 100644 --- a/lib/rules/no-sync.js +++ b/lib/rules/no-sync.js @@ -6,7 +6,6 @@ module.exports = { meta: { - type: "suggestion", docs: { description: "disallow synchronous methods", category: "Stylistic Issues", @@ -15,6 +14,9 @@ module.exports = { "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-sync.md", }, fixable: null, + messages: { + noSync: "Unexpected sync method: '{{propertyName}}'.", + }, schema: [ { type: "object", @@ -27,9 +29,7 @@ module.exports = { additionalProperties: false, }, ], - messages: { - noSync: "Unexpected sync method: '{{propertyName}}'.", - }, + type: "suggestion", }, create(context) { diff --git a/lib/rules/no-unpublished-bin.js b/lib/rules/no-unpublished-bin.js index 47d428fb..240626fd 100644 --- a/lib/rules/no-unpublished-bin.js +++ b/lib/rules/no-unpublished-bin.js @@ -38,7 +38,6 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-unpublished-bin.md", }, - type: "problem", fixable: null, schema: [ { @@ -49,6 +48,7 @@ module.exports = { }, }, ], + type: "problem", }, create(context) { return { diff --git a/lib/rules/no-unpublished-import.js b/lib/rules/no-unpublished-import.js index bdd75436..549b4f32 100644 --- a/lib/rules/no-unpublished-import.js +++ b/lib/rules/no-unpublished-import.js @@ -21,7 +21,6 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-unpublished-import.md", }, - type: "problem", fixable: null, schema: [ { @@ -35,6 +34,7 @@ module.exports = { additionalProperties: false, }, ], + type: "problem", }, create(context) { const filePath = context.getFilename() diff --git a/lib/rules/no-unpublished-require.js b/lib/rules/no-unpublished-require.js index f45c5cc0..97efe436 100644 --- a/lib/rules/no-unpublished-require.js +++ b/lib/rules/no-unpublished-require.js @@ -21,7 +21,6 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-unpublished-require.md", }, - type: "problem", fixable: null, schema: [ { @@ -35,6 +34,7 @@ module.exports = { additionalProperties: false, }, ], + type: "problem", }, create(context) { const filePath = context.getFilename() diff --git a/lib/rules/no-unsupported-features.js b/lib/rules/no-unsupported-features.js index 73d422f7..7e48b527 100644 --- a/lib/rules/no-unsupported-features.js +++ b/lib/rules/no-unsupported-features.js @@ -1041,6 +1041,7 @@ function hasPattern(s, pattern) { module.exports = { meta: { + deprecated: true, docs: { description: "disallow unsupported ECMAScript features on the specified version", @@ -1053,8 +1054,6 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-unsupported-features.md", }, - type: "problem", - deprecated: true, fixable: null, schema: [ { @@ -1076,6 +1075,7 @@ module.exports = { ], }, ], + type: "problem", }, create(context) { const sourceCode = context.getSourceCode() diff --git a/lib/rules/no-unsupported-features/es-builtins.js b/lib/rules/no-unsupported-features/es-builtins.js index 3165afa9..7af4feed 100644 --- a/lib/rules/no-unsupported-features/es-builtins.js +++ b/lib/rules/no-unsupported-features/es-builtins.js @@ -144,8 +144,11 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-unsupported-features/es-builtins.md", }, - type: "problem", fixable: null, + messages: { + unsupported: + "The '{{name}}' is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + }, schema: [ { type: "object", @@ -166,10 +169,7 @@ module.exports = { additionalProperties: false, }, ], - messages: { - unsupported: - "The '{{name}}' is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - }, + type: "problem", }, create(context) { return { diff --git a/lib/rules/no-unsupported-features/es-syntax.js b/lib/rules/no-unsupported-features/es-syntax.js index edcc4168..216b20c0 100644 --- a/lib/rules/no-unsupported-features/es-syntax.js +++ b/lib/rules/no-unsupported-features/es-syntax.js @@ -505,26 +505,7 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-unsupported-features/es-syntax.md", }, - type: "problem", fixable: null, - schema: [ - { - type: "object", - properties: { - version: { - type: "string", - }, - ignores: { - type: "array", - items: { - enum: Object.keys(features), - }, - uniqueItems: true, - }, - }, - additionalProperties: false, - }, - ], messages: { //------------------------------------------------------------------ // ES2015 @@ -630,6 +611,25 @@ module.exports = { "no-dynamic-import": "'import()' expressions are not supported yet.", }, + schema: [ + { + type: "object", + properties: { + version: { + type: "string", + }, + ignores: { + type: "array", + items: { + enum: Object.keys(features), + }, + uniqueItems: true, + }, + }, + additionalProperties: false, + }, + ], + type: "problem", }, create(context) { return defineVisitor(context, parseOptions(context)) diff --git a/lib/rules/no-unsupported-features/node-builtins.js b/lib/rules/no-unsupported-features/node-builtins.js index 347e04ad..03eedd9e 100644 --- a/lib/rules/no-unsupported-features/node-builtins.js +++ b/lib/rules/no-unsupported-features/node-builtins.js @@ -329,8 +329,11 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-unsupported-features/node-builtins.md", }, - type: "problem", fixable: null, + messages: { + unsupported: + "The '{{name}}' is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", + }, schema: [ { type: "object", @@ -354,10 +357,7 @@ module.exports = { additionalProperties: false, }, ], - messages: { - unsupported: - "The '{{name}}' is not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", - }, + type: "problem", }, create(context) { return { diff --git a/lib/rules/prefer-global/buffer.js b/lib/rules/prefer-global/buffer.js index 86c2ba38..1085d0bc 100644 --- a/lib/rules/prefer-global/buffer.js +++ b/lib/rules/prefer-global/buffer.js @@ -28,15 +28,15 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/prefer-global/buffer.md", }, - type: "suggestion", fixable: null, - schema: [{ enum: ["always", "never"] }], messages: { preferGlobal: "Unexpected use of 'require(\"buffer\").Buffer'. Use the global variable 'Buffer' instead.", preferModule: "Unexpected use of the global variable 'Buffer'. Use 'require(\"buffer\").Buffer' instead.", }, + schema: [{ enum: ["always", "never"] }], + type: "suggestion", }, create(context) { diff --git a/lib/rules/prefer-global/console.js b/lib/rules/prefer-global/console.js index e03c5115..2301c553 100644 --- a/lib/rules/prefer-global/console.js +++ b/lib/rules/prefer-global/console.js @@ -25,15 +25,15 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/prefer-global/console.md", }, - type: "suggestion", fixable: null, - schema: [{ enum: ["always", "never"] }], messages: { preferGlobal: "Unexpected use of 'require(\"console\")'. Use the global variable 'console' instead.", preferModule: "Unexpected use of the global variable 'console'. Use 'require(\"console\")' instead.", }, + schema: [{ enum: ["always", "never"] }], + type: "suggestion", }, create(context) { diff --git a/lib/rules/prefer-global/process.js b/lib/rules/prefer-global/process.js index 05482f75..d7c66ac8 100644 --- a/lib/rules/prefer-global/process.js +++ b/lib/rules/prefer-global/process.js @@ -25,15 +25,15 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/prefer-global/process.md", }, - type: "suggestion", fixable: null, - schema: [{ enum: ["always", "never"] }], messages: { preferGlobal: "Unexpected use of 'require(\"process\")'. Use the global variable 'process' instead.", preferModule: "Unexpected use of the global variable 'process'. Use 'require(\"process\")' instead.", }, + schema: [{ enum: ["always", "never"] }], + type: "suggestion", }, create(context) { diff --git a/lib/rules/prefer-global/text-decoder.js b/lib/rules/prefer-global/text-decoder.js index 4a703784..3dc68640 100644 --- a/lib/rules/prefer-global/text-decoder.js +++ b/lib/rules/prefer-global/text-decoder.js @@ -28,15 +28,15 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/prefer-global/text-decoder.md", }, - type: "suggestion", fixable: null, - schema: [{ enum: ["always", "never"] }], messages: { preferGlobal: "Unexpected use of 'require(\"util\").TextDecoder'. Use the global variable 'TextDecoder' instead.", preferModule: "Unexpected use of the global variable 'TextDecoder'. Use 'require(\"util\").TextDecoder' instead.", }, + schema: [{ enum: ["always", "never"] }], + type: "suggestion", }, create(context) { diff --git a/lib/rules/prefer-global/text-encoder.js b/lib/rules/prefer-global/text-encoder.js index 476531b0..425261fa 100644 --- a/lib/rules/prefer-global/text-encoder.js +++ b/lib/rules/prefer-global/text-encoder.js @@ -28,15 +28,15 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/prefer-global/text-encoder.md", }, - type: "suggestion", fixable: null, - schema: [{ enum: ["always", "never"] }], messages: { preferGlobal: "Unexpected use of 'require(\"util\").TextEncoder'. Use the global variable 'TextEncoder' instead.", preferModule: "Unexpected use of the global variable 'TextEncoder'. Use 'require(\"util\").TextEncoder' instead.", }, + schema: [{ enum: ["always", "never"] }], + type: "suggestion", }, create(context) { diff --git a/lib/rules/prefer-global/url-search-params.js b/lib/rules/prefer-global/url-search-params.js index 5163317d..924e011b 100644 --- a/lib/rules/prefer-global/url-search-params.js +++ b/lib/rules/prefer-global/url-search-params.js @@ -28,15 +28,15 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/prefer-global/url-search-params.md", }, - type: "suggestion", fixable: null, - schema: [{ enum: ["always", "never"] }], messages: { preferGlobal: "Unexpected use of 'require(\"url\").URLSearchParams'. Use the global variable 'URLSearchParams' instead.", preferModule: "Unexpected use of the global variable 'URLSearchParams'. Use 'require(\"url\").URLSearchParams' instead.", }, + schema: [{ enum: ["always", "never"] }], + type: "suggestion", }, create(context) { diff --git a/lib/rules/prefer-global/url.js b/lib/rules/prefer-global/url.js index b87130de..c5881ef2 100644 --- a/lib/rules/prefer-global/url.js +++ b/lib/rules/prefer-global/url.js @@ -27,15 +27,15 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/prefer-global/url.md", }, - type: "suggestion", fixable: null, - schema: [{ enum: ["always", "never"] }], messages: { preferGlobal: "Unexpected use of 'require(\"url\").URL'. Use the global variable 'URL' instead.", preferModule: "Unexpected use of the global variable 'URL'. Use 'require(\"url\").URL' instead.", }, + schema: [{ enum: ["always", "never"] }], + type: "suggestion", }, create(context) { diff --git a/lib/rules/process-exit-as-throw.js b/lib/rules/process-exit-as-throw.js index 643b79c6..71332fb4 100644 --- a/lib/rules/process-exit-as-throw.js +++ b/lib/rules/process-exit-as-throw.js @@ -153,9 +153,9 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/process-exit-as-throw.md", }, - type: "problem", fixable: null, schema: [], + type: "problem", supported: CodePathAnalyzer != null, }, create() { diff --git a/lib/rules/shebang.js b/lib/rules/shebang.js index 9889d8db..e6c831cf 100644 --- a/lib/rules/shebang.js +++ b/lib/rules/shebang.js @@ -75,7 +75,6 @@ module.exports = { url: "https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/shebang.md", }, - type: "problem", fixable: "code", schema: [ { @@ -87,6 +86,7 @@ module.exports = { additionalProperties: false, }, ], + type: "problem", }, create(context) { const sourceCode = context.getSourceCode() diff --git a/lib/util/visit-import.js b/lib/util/visit-import.js index 905e5bda..356669d7 100644 --- a/lib/util/visit-import.js +++ b/lib/util/visit-import.js @@ -25,7 +25,7 @@ const stripImportPathParams = require("./strip-import-path-params") */ module.exports = function visitImport( context, - { includeCore = false, optionIndex = 0 } = {}, + { includeCore = false, optionIndex = 0 }, callback ) { const targets = [] diff --git a/lib/util/visit-require.js b/lib/util/visit-require.js index 23c92aa7..d130c3d7 100644 --- a/lib/util/visit-require.js +++ b/lib/util/visit-require.js @@ -25,7 +25,7 @@ const stripImportPathParams = require("./strip-import-path-params") */ module.exports = function visitRequire( context, - { includeCore = false } = {}, + { includeCore = false }, callback ) { const targets = [] diff --git a/tests/lib/configs/recommended.js b/tests/lib/configs/recommended.js index abcaf074..8f9c5817 100644 --- a/tests/lib/configs/recommended.js +++ b/tests/lib/configs/recommended.js @@ -7,13 +7,13 @@ const originalCwd = process.cwd() describe("node/recommended config", () => { describe("in CJS directory", () => { - const root = path.resolve(__dirname, "../../fixtures/configs/cjs/") + const CJSRoot = path.resolve(__dirname, "../../fixtures/configs/cjs/") /** @type {CLIEngine} */ let engine = null beforeEach(() => { - process.chdir(root) + process.chdir(CJSRoot) engine = new CLIEngine({ baseConfig: { extends: "plugin:node/recommended" }, useEslintrc: false, @@ -27,7 +27,7 @@ describe("node/recommended config", () => { it("*.js files should be a script.", () => { const report = engine.executeOnText( "import 'foo'", - path.join(root, "test.js") + path.join(CJSRoot, "test.js") ) assert.deepStrictEqual(report.results[0].messages, [ @@ -46,7 +46,7 @@ describe("node/recommended config", () => { it("*.cjs files should be a script.", () => { const report = engine.executeOnText( "import 'foo'", - path.join(root, "test.cjs") + path.join(CJSRoot, "test.cjs") ) assert.deepStrictEqual(report.results[0].messages, [ @@ -65,7 +65,7 @@ describe("node/recommended config", () => { it("*.mjs files should be a module.", () => { const report = engine.executeOnText( "import 'foo'", - path.join(root, "test.mjs") + path.join(CJSRoot, "test.mjs") ) assert.deepStrictEqual(report.results[0].messages, [ @@ -84,13 +84,13 @@ describe("node/recommended config", () => { }) describe("in ESM directory", () => { - const root = path.resolve(__dirname, "../../fixtures/configs/esm/") + const ESMRoot = path.resolve(__dirname, "../../fixtures/configs/esm/") /** @type {CLIEngine} */ let engine = null beforeEach(() => { - process.chdir(root) + process.chdir(ESMRoot) engine = new CLIEngine({ baseConfig: { extends: "plugin:node/recommended" }, useEslintrc: false, @@ -104,7 +104,7 @@ describe("node/recommended config", () => { it("*.js files should be a module.", () => { const report = engine.executeOnText( "import 'foo'", - path.join(root, "test.js") + path.join(ESMRoot, "test.js") ) assert.deepStrictEqual(report.results[0].messages, [ @@ -124,7 +124,7 @@ describe("node/recommended config", () => { it("*.cjs files should be a script.", () => { const report = engine.executeOnText( "import 'foo'", - path.join(root, "test.cjs") + path.join(ESMRoot, "test.cjs") ) assert.deepStrictEqual(report.results[0].messages, [ @@ -143,7 +143,7 @@ describe("node/recommended config", () => { it("*.mjs files should be a module.", () => { const report = engine.executeOnText( "import 'foo'", - path.join(root, "test.mjs") + path.join(ESMRoot, "test.mjs") ) assert.deepStrictEqual(report.results[0].messages, [ diff --git a/tests/lib/rules/no-unsupported-features.js b/tests/lib/rules/no-unsupported-features.js index 9593cf8f..b7ba35bb 100644 --- a/tests/lib/rules/no-unsupported-features.js +++ b/tests/lib/rules/no-unsupported-features.js @@ -81,9 +81,7 @@ function convertPattern(retv, pattern) { ;[].push.apply( retv.valid, pattern.keys.map(key => ({ - code: `/*${ - pattern.name - }: ${versionText}, ignores: ["${key}"]*/ ${pattern.code}`, + code: `/*${pattern.name}: ${versionText}, ignores: ["${key}"]*/ ${pattern.code}`, env: { es6: true }, globals: { SharedArrayBuffer: false, Atomics: false }, options: [{ version, ignores: [key] }],