eslint-plugin-n
Advanced tools
Comparing version 16.3.1 to 16.6.0
"use strict" | ||
module.exports = { | ||
commonGlobals: { | ||
// ECMAScript | ||
ArrayBuffer: "readonly", | ||
Atomics: "readonly", | ||
BigInt: "readonly", | ||
BigInt64Array: "readonly", | ||
BigUint64Array: "readonly", | ||
DataView: "readonly", | ||
Float32Array: "readonly", | ||
Float64Array: "readonly", | ||
Int16Array: "readonly", | ||
Int32Array: "readonly", | ||
Int8Array: "readonly", | ||
Map: "readonly", | ||
Promise: "readonly", | ||
Proxy: "readonly", | ||
Reflect: "readonly", | ||
Set: "readonly", | ||
SharedArrayBuffer: "readonly", | ||
Symbol: "readonly", | ||
Uint16Array: "readonly", | ||
Uint32Array: "readonly", | ||
Uint8Array: "readonly", | ||
Uint8ClampedArray: "readonly", | ||
WeakMap: "readonly", | ||
WeakSet: "readonly", | ||
// ECMAScript (experimental) | ||
globalThis: "readonly", | ||
// ECMA-402 | ||
Intl: "readonly", | ||
// Web Standard | ||
TextDecoder: "readonly", | ||
TextEncoder: "readonly", | ||
URL: "readonly", | ||
URLSearchParams: "readonly", | ||
WebAssembly: "readonly", | ||
clearInterval: "readonly", | ||
clearTimeout: "readonly", | ||
console: "readonly", | ||
queueMicrotask: "readonly", | ||
setInterval: "readonly", | ||
setTimeout: "readonly", | ||
// Node.js | ||
Buffer: "readonly", | ||
GLOBAL: "readonly", | ||
clearImmediate: "readonly", | ||
global: "readonly", | ||
process: "readonly", | ||
root: "readonly", | ||
setImmediate: "readonly", | ||
}, | ||
commonRules: { | ||
@@ -60,0 +5,0 @@ "n/no-deprecated-api": "error", |
"use strict" | ||
const { commonGlobals, commonRules } = require("./_commons") | ||
const globals = require("globals") | ||
const { commonRules } = require("./_commons") | ||
// eslintrc config: https://eslint.org/docs/latest/use/configure/configuration-files | ||
module.exports.eslintrc = { | ||
env: { | ||
node: true, | ||
es2021: true, | ||
}, | ||
globals: { | ||
...commonGlobals, | ||
__dirname: "off", | ||
@@ -33,5 +37,9 @@ __filename: "off", | ||
sourceType: "module", | ||
globals: module.exports.eslintrc.globals, | ||
globals: { | ||
...globals.node, | ||
...globals.es2021, | ||
...module.exports.eslintrc.globals, | ||
}, | ||
}, | ||
rules: module.exports.eslintrc.rules, | ||
} |
"use strict" | ||
const { commonGlobals, commonRules } = require("./_commons") | ||
const globals = require("globals") | ||
const { commonRules } = require("./_commons") | ||
// eslintrc config: https://eslint.org/docs/latest/use/configure/configuration-files | ||
module.exports.eslintrc = { | ||
env: { | ||
node: true, | ||
es2021: true, | ||
}, | ||
globals: { | ||
...commonGlobals, | ||
__dirname: "readonly", | ||
@@ -30,5 +34,9 @@ __filename: "readonly", | ||
sourceType: "commonjs", | ||
globals: module.exports.eslintrc.globals, | ||
globals: { | ||
...globals.node, | ||
...globals.es2021, | ||
...module.exports.eslintrc.globals, | ||
}, | ||
}, | ||
rules: module.exports.eslintrc.rules, | ||
} |
@@ -29,3 +29,3 @@ /** | ||
const callbacks = context.options[0] || ["callback", "cb", "next"] | ||
const sourceCode = context.getSourceCode() | ||
const sourceCode = context.sourceCode ?? context.getSourceCode() // TODO: just use context.sourceCode when dropping eslint < v9 | ||
@@ -32,0 +32,0 @@ /** |
@@ -261,3 +261,3 @@ /** | ||
) | ||
const sourceCode = context.getSourceCode() | ||
const sourceCode = context.sourceCode ?? context.getSourceCode() // TODO: just use context.sourceCode when dropping eslint < v9 | ||
@@ -290,4 +290,3 @@ /** | ||
*/ | ||
function enforceModuleExports() { | ||
const globalScope = context.getScope() | ||
function enforceModuleExports(globalScope) { | ||
const exportsNodes = getExportsNodes(globalScope) | ||
@@ -322,4 +321,3 @@ const assignList = batchAssignAllowed | ||
*/ | ||
function enforceExports() { | ||
const globalScope = context.getScope() | ||
function enforceExports(globalScope) { | ||
const exportsNodes = getExportsNodes(globalScope) | ||
@@ -376,9 +374,11 @@ const moduleExportsNodes = getModuleExportsNodes(globalScope) | ||
return { | ||
"Program:exit"() { | ||
"Program:exit"(node) { | ||
const scope = sourceCode.getScope?.(node) ?? context.getScope() //TODO: remove context.getScope() when dropping support for ESLint < v9 | ||
switch (mode) { | ||
case "module.exports": | ||
enforceModuleExports() | ||
enforceModuleExports(scope) | ||
break | ||
case "exports": | ||
enforceExports() | ||
enforceExports(scope) | ||
break | ||
@@ -385,0 +385,0 @@ |
@@ -60,3 +60,3 @@ /** | ||
create(context) { | ||
if (context.getFilename().startsWith("<")) { | ||
if ((context.filename ?? context.getFilename()).startsWith("<")) { | ||
return {} | ||
@@ -63,0 +63,0 @@ } |
@@ -67,5 +67,8 @@ /** | ||
create(context) { | ||
const sourceCode = context.sourceCode ?? context.getSourceCode() // TODO: just use context.sourceCode when dropping eslint < v9 | ||
return { | ||
CallExpression(node) { | ||
const currentScope = context.getScope() | ||
const currentScope = | ||
sourceCode.getScope?.(node) ?? context.getScope() //TODO: remove context.getScope() when dropping support for ESLint < v9 | ||
@@ -76,4 +79,6 @@ if ( | ||
) { | ||
const isGoodRequire = context | ||
.getAncestors() | ||
const isGoodRequire = ( | ||
sourceCode.getAncestors?.(node) ?? | ||
context.getAncestors() | ||
) // TODO: remove context.getAncestors() when dropping support for ESLint < v9 | ||
.every( | ||
@@ -80,0 +85,0 @@ parent => |
@@ -27,2 +27,3 @@ /** | ||
create(context) { | ||
const sourceCode = context.sourceCode ?? context.getSourceCode() // TODO: just use context.sourceCode when dropping eslint < v9 | ||
const errorArgument = context.options[0] || "err" | ||
@@ -73,3 +74,3 @@ | ||
function checkForError(node) { | ||
const scope = context.getScope() | ||
const scope = sourceCode.getScope?.(node) ?? context.getScope() //TODO: remove context.getScope() when dropping support for ESLint < v9 | ||
const parameters = getParameters(scope) | ||
@@ -76,0 +77,0 @@ const firstParameter = parameters[0] |
@@ -759,5 +759,8 @@ /** | ||
const sourceCode = context.sourceCode ?? context.getSourceCode() // TODO: just use context.sourceCode when dropping eslint < v9 | ||
return { | ||
"Program:exit"() { | ||
const tracker = new ReferenceTracker(context.getScope(), { | ||
"Program:exit"(node) { | ||
const scope = sourceCode.getScope?.(node) ?? context.getScope() //TODO: remove context.getScope() when dropping support for ESLint < v9 | ||
const tracker = new ReferenceTracker(scope, { | ||
mode: "legacy", | ||
@@ -764,0 +767,0 @@ }) |
@@ -53,5 +53,8 @@ /** | ||
create(context) { | ||
const sourceCode = context.sourceCode ?? context.getSourceCode() // TODO: just use context.sourceCode when dropping eslint < v9 | ||
return { | ||
AssignmentExpression(node) { | ||
const scope = context.getScope() | ||
const scope = sourceCode.getScope?.(node) ?? context.getScope() //TODO: remove context.getScope() when dropping support for ESLint < v9 | ||
if ( | ||
@@ -58,0 +61,0 @@ !isExports(node.left, scope) || |
@@ -37,3 +37,3 @@ /** | ||
create(context) { | ||
const filePath = context.getFilename() | ||
const filePath = context.filename ?? context.getFilename() | ||
if (filePath === "<input>") { | ||
@@ -40,0 +40,0 @@ return {} |
@@ -39,3 +39,3 @@ /** | ||
create(context) { | ||
const filePath = context.getFilename() | ||
const filePath = context.filename ?? context.getFilename() | ||
if (filePath === "<input>") { | ||
@@ -42,0 +42,0 @@ return {} |
@@ -88,6 +88,7 @@ /** | ||
create(context) { | ||
if (context.getFilename() === "<input>") { | ||
const filename = context.filename ?? context.getFilename() | ||
if (filename === "<input>") { | ||
return {} | ||
} | ||
const filePath = path.resolve(context.getFilename()) | ||
const filePath = path.resolve(filename) | ||
const dirPath = path.dirname(filePath) | ||
@@ -94,0 +95,0 @@ const packageJson = getPackageJson(filePath) |
@@ -39,3 +39,3 @@ /** | ||
create(context) { | ||
const filePath = context.getFilename() | ||
const filePath = context.filename ?? context.getFilename() | ||
if (filePath === "<input>") { | ||
@@ -42,0 +42,0 @@ return {} |
@@ -41,3 +41,3 @@ /** | ||
create(context) { | ||
const filePath = context.getFilename() | ||
const filePath = context.filename ?? context.getFilename() | ||
if (filePath === "<input>") { | ||
@@ -44,0 +44,0 @@ return {} |
@@ -182,4 +182,6 @@ /** | ||
return { | ||
"Program:exit"() { | ||
const globalScope = context.getScope() | ||
"Program:exit"(node) { | ||
const sourceCode = context.sourceCode ?? context.getSourceCode() // TODO: just use context.sourceCode when dropping eslint < v9 | ||
const globalScope = | ||
sourceCode.getScope?.(node) ?? context.getScope() | ||
const tracker = new ReferenceTracker(globalScope) | ||
@@ -186,0 +188,0 @@ const sepNodes = new Set() |
@@ -59,3 +59,3 @@ /** | ||
// Check file path. | ||
let rawFilePath = context.getFilename() | ||
let rawFilePath = context.filename ?? context.getFilename() | ||
if (rawFilePath === "<input>") { | ||
@@ -62,0 +62,0 @@ return |
@@ -38,3 +38,3 @@ /** | ||
create(context) { | ||
const filePath = context.getFilename() | ||
const filePath = context.filename ?? context.getFilename() | ||
const options = context.options[0] || {} | ||
@@ -41,0 +41,0 @@ const ignoreTypeImport = |
@@ -39,3 +39,3 @@ /** | ||
create(context) { | ||
const filePath = context.getFilename() | ||
const filePath = context.filename ?? context.getFilename() | ||
if (filePath === "<input>") { | ||
@@ -42,0 +42,0 @@ return {} |
@@ -1088,6 +1088,6 @@ /** | ||
create(context) { | ||
const sourceCode = context.getSourceCode() | ||
const sourceCode = context.sourceCode ?? context.getSourceCode() // TODO: just use context.sourceCode when dropping eslint < v9 | ||
const supportInfo = parseOptions( | ||
context.options[0], | ||
getDefaultVersion(context.getFilename()) | ||
getDefaultVersion(context.filename ?? context.getFilename()) | ||
) | ||
@@ -1102,3 +1102,4 @@ | ||
function* getReferences(names) { | ||
const globalScope = context.getScope() | ||
const globalScope = | ||
sourceCode.getScope?.(sourceCode.ast) ?? context.getScope() //TODO: remove context.getScope() when dropping support for ESLint < v9 | ||
@@ -1164,2 +1165,4 @@ for (const name of names) { | ||
function report(node, key) { | ||
const globalScope = | ||
sourceCode.getScope?.(node) ?? context.getScope() //TODO: remove context.getScope() when dropping support for ESLint < v9 | ||
const version = supportInfo.version | ||
@@ -1181,3 +1184,3 @@ const feature = supportInfo.features[key] | ||
}) | ||
} else if (!normalizeScope(context.getScope(), node).isStrict) { | ||
} else if (!normalizeScope(globalScope, node).isStrict) { | ||
context.report({ | ||
@@ -1338,3 +1341,5 @@ node, | ||
FunctionDeclaration(node) { | ||
const scope = context.getScope().upper | ||
const scope = ( | ||
sourceCode.getScope?.(node) ?? context.getScope() | ||
).upper //TODO: remove context.getScope() when dropping support for ESLint < v9 | ||
if (!TOPLEVEL_SCOPE_TYPE.test(scope.type)) { | ||
@@ -1341,0 +1346,0 @@ report(node, "blockScopedFunctions") |
@@ -17,2 +17,5 @@ /** | ||
globals: { | ||
AggregateError: { | ||
[READ]: { supported: "15.0.0" }, | ||
}, | ||
Array: { | ||
@@ -25,2 +28,5 @@ from: { [READ]: { supported: "4.0.0" } }, | ||
}, | ||
FinalizationRegistry: { | ||
[READ]: { supported: "14.6.0" }, | ||
}, | ||
Map: { | ||
@@ -72,2 +78,3 @@ [READ]: { supported: "0.12.0" }, | ||
allSettled: { [READ]: { supported: "12.9.0" } }, | ||
any: { [READ]: { supported: "15.0.0" } }, | ||
}, | ||
@@ -129,2 +136,5 @@ Proxy: { | ||
}, | ||
WeakRef: { | ||
[READ]: { supported: "14.6.0" }, | ||
}, | ||
WeakSet: { | ||
@@ -131,0 +141,0 @@ [READ]: { supported: "0.12.0" }, |
@@ -405,2 +405,24 @@ /** | ||
}, | ||
//-------------------------------------------------------------------------- | ||
// ES2021 | ||
//-------------------------------------------------------------------------- | ||
logicalAssignmentOperators: { | ||
ruleId: "no-logical-assignment-operators", | ||
cases: [ | ||
{ | ||
supported: "15.0.0", | ||
messageId: "no-logical-assignment-operators", | ||
}, | ||
], | ||
}, | ||
numericSeparators: { | ||
ruleId: "no-numeric-separators", | ||
cases: [ | ||
{ | ||
supported: "12.5.0", | ||
messageId: "no-numeric-separators", | ||
}, | ||
], | ||
}, | ||
} | ||
@@ -447,3 +469,5 @@ const keywords = Object.keys(features) | ||
get isStrict() { | ||
return normalizeScope(context.getScope(), this.node).isStrict | ||
const sourceCode = context.sourceCode ?? context.getSourceCode() // TODO: just use context.sourceCode when dropping eslint < v9 | ||
const scope = sourceCode.getScope?.(this.node) ?? context.getScope() //TODO: remove context.getScope() when dropping support for ESLint < v9 | ||
return normalizeScope(scope, this.node).isStrict | ||
}, | ||
@@ -657,2 +681,10 @@ } | ||
"Nullish coalescing operators are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", | ||
//------------------------------------------------------------------ | ||
// ES2021 | ||
//------------------------------------------------------------------ | ||
"no-logical-assignment-operators": | ||
"Logical assignment operators are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", | ||
"no-numeric-separators": | ||
"Numeric separators are not supported until Node.js {{supported}}. The configured version range is '{{version}}'.", | ||
}, | ||
@@ -659,0 +691,0 @@ }, |
@@ -375,4 +375,2 @@ /** | ||
/*eslint-enable camelcase */ | ||
module.exports = { | ||
@@ -379,0 +377,0 @@ meta: { |
@@ -55,4 +55,5 @@ /** | ||
return { | ||
"Program:exit"() { | ||
const scope = context.getScope() | ||
"Program:exit"(node) { | ||
const sourceCode = context.sourceCode ?? context.getSourceCode() // TODO: just use context.sourceCode when dropping eslint < v9 | ||
const scope = sourceCode.getScope?.(node) ?? context.getScope() //TODO: remove context.getScope() when dropping support for ESLint < v9 | ||
const tracker = new ReferenceTracker(scope, { mode: "legacy" }) | ||
@@ -59,0 +60,0 @@ const references = [ |
@@ -56,4 +56,5 @@ /** | ||
return { | ||
"Program:exit"() { | ||
const scope = context.getScope() | ||
"Program:exit"(node) { | ||
const sourceCode = context.sourceCode ?? context.getSourceCode() // TODO: just use context.sourceCode when dropping eslint < v9 | ||
const scope = sourceCode.getScope?.(node) ?? context.getScope() //TODO: remove context.getScope() when dropping support for ESLint < v9 | ||
const tracker = new ReferenceTracker(scope, { mode: "legacy" }) | ||
@@ -60,0 +61,0 @@ const references = [ |
@@ -97,4 +97,4 @@ /** | ||
create(context) { | ||
const sourceCode = context.getSourceCode() | ||
let filePath = context.getFilename() | ||
const sourceCode = context.sourceCode ?? context.getSourceCode() // TODO: just use context.sourceCode when dropping eslint < v9 | ||
let filePath = context.filename ?? context.getFilename() | ||
if (filePath === "<input>") { | ||
@@ -101,0 +101,0 @@ return {} |
@@ -34,3 +34,6 @@ /** | ||
const { context, trackMap } = this | ||
const tracker = new ReferenceTracker(context.getScope(), { | ||
const sourceCode = context.sourceCode ?? context.getSourceCode() // TODO: just use context.sourceCode when dropping eslint < v9 | ||
const scope = | ||
sourceCode.getScope?.(sourceCode.ast) ?? context.getScope() //TODO: remove context.getScope() when dropping support for ESLint < v9 | ||
const tracker = new ReferenceTracker(scope, { | ||
mode: "legacy", | ||
@@ -55,3 +58,6 @@ }) | ||
const { context, trackMap } = this | ||
const tracker = new ReferenceTracker(context.getScope()) | ||
const sourceCode = context.sourceCode ?? context.getSourceCode() // TODO: just use context.sourceCode when dropping eslint < v9 | ||
const scope = | ||
sourceCode.getScope?.(sourceCode.ast) ?? context.getScope() //TODO: remove context.getScope() when dropping support for ESLint < v9 | ||
const tracker = new ReferenceTracker(scope) | ||
@@ -58,0 +64,0 @@ for (const { node } of tracker.iterateGlobalReferences( |
@@ -88,3 +88,5 @@ /** | ||
const options = parseOptions(context) | ||
const tracker = new ReferenceTracker(context.getScope(), { mode: "legacy" }) | ||
const sourceCode = context.sourceCode ?? context.getSourceCode() // TODO: just use context.sourceCode when dropping eslint < v9 | ||
const scope = sourceCode.getScope?.(sourceCode.ast) ?? context.getScope() //TODO: remove context.getScope() when dropping support for ESLint < v9 | ||
const tracker = new ReferenceTracker(scope, { mode: "legacy" }) | ||
const references = [ | ||
@@ -91,0 +93,0 @@ ...tracker.iterateCjsReferences(trackMap.modules || {}), |
@@ -50,3 +50,3 @@ /** | ||
get(context.settings && (context.settings.n || context.settings.node)) | ||
const filePath = context.getFilename() | ||
const filePath = context.filename ?? context.getFilename() | ||
@@ -53,0 +53,0 @@ return ( |
@@ -115,15 +115,11 @@ "use strict" | ||
module.exports = function getTypescriptExtensionMap(context) { | ||
const filename = | ||
context.physicalFilename ?? | ||
context.getPhysicalFilename?.() ?? | ||
context.filename ?? | ||
context.getFilename?.() // TODO: remove context.get(PhysicalFilename|Filename) when dropping eslint < v10 | ||
return ( | ||
get(context.options?.[0]) || | ||
get(context.settings?.n ?? context.settings?.node) || | ||
getFromTSConfigFromFile( | ||
// eslint ^8 | ||
context.physicalFilename ?? | ||
// eslint ^7.28 (deprecated ^8) | ||
context.getPhysicalFilename?.() ?? | ||
// eslint ^8 (if physicalFilename undefined) | ||
context.filename ?? | ||
// eslint ^7 (deprecated ^8) | ||
context.getFilename?.() | ||
) || | ||
getFromTSConfigFromFile(filename) || | ||
PRESERVE_MAPPING | ||
@@ -130,0 +126,0 @@ ) |
@@ -14,4 +14,6 @@ "use strict" | ||
module.exports = function isTypescript(context) { | ||
const sourceFileExt = path.extname(context.getPhysicalFilename()) | ||
const sourceFileExt = path.extname( | ||
context.physicalFilename ?? context.getPhysicalFilename() | ||
) | ||
return typescriptExtensions.includes(sourceFileExt) | ||
} |
@@ -33,3 +33,5 @@ /** | ||
const targets = [] | ||
const basedir = path.dirname(path.resolve(context.getFilename())) | ||
const basedir = path.dirname( | ||
path.resolve(context.filename ?? context.getFilename()) | ||
) | ||
const paths = getResolvePaths(context, optionIndex) | ||
@@ -36,0 +38,0 @@ const extensions = getTryExtensions(context, optionIndex) |
@@ -36,3 +36,5 @@ /** | ||
const targets = [] | ||
const basedir = path.dirname(path.resolve(context.getFilename())) | ||
const basedir = path.dirname( | ||
path.resolve(context.filename ?? context.getFilename()) | ||
) | ||
const paths = getResolvePaths(context) | ||
@@ -43,4 +45,7 @@ const extensions = getTryExtensions(context) | ||
return { | ||
"Program:exit"() { | ||
const tracker = new ReferenceTracker(context.getScope()) | ||
"Program:exit"(node) { | ||
const sourceCode = context.sourceCode ?? context.getSourceCode() // TODO: just use context.sourceCode when dropping eslint < v9 | ||
const tracker = new ReferenceTracker( | ||
sourceCode.getScope?.(node) ?? context.getScope() //TODO: remove context.getScope() when dropping support for ESLint < v9 | ||
) | ||
const references = tracker.iterateGlobalReferences({ | ||
@@ -47,0 +52,0 @@ require: { |
{ | ||
"name": "eslint-plugin-n", | ||
"version": "16.3.1", | ||
"version": "16.6.0", | ||
"description": "Additional ESLint's rules for Node.js", | ||
@@ -19,4 +19,5 @@ "engines": { | ||
"builtins": "^5.0.1", | ||
"eslint-plugin-es-x": "^7.1.0", | ||
"eslint-plugin-es-x": "^7.5.0", | ||
"get-tsconfig": "^4.7.0", | ||
"globals": "^13.24.0", | ||
"ignore": "^5.2.4", | ||
@@ -31,12 +32,11 @@ "is-builtin-module": "^3.2.1", | ||
"@eslint/js": "^8.43.0", | ||
"@types/eslint": "^8.44.2", | ||
"@types/eslint": "^8.44.6", | ||
"@typescript-eslint/parser": "^5.60.0", | ||
"esbuild": "^0.18.7", | ||
"eslint": "^8.43.0", | ||
"eslint": "^8.53.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-doc-generator": "^1.4.3", | ||
"eslint-doc-generator": "^1.6.1", | ||
"eslint-plugin-eslint-plugin": "^5.1.0", | ||
"eslint-plugin-n": "file:.", | ||
"fast-glob": "^3.2.12", | ||
"globals": "^13.20.0", | ||
"husky": "^8.0.3", | ||
@@ -43,0 +43,0 @@ "import-meta-resolve": "^3.0.0", |
@@ -11,2 +11,6 @@ # eslint-plugin-n | ||
## π¨ Playground | ||
[online-playground](https://eslint-online-playground.netlify.app/#eNp1jzEOwjAMRa9SeWFpYS8rOwtiIQxRalWBxIniFIFQ747bCASV2BK/Lz//J3AyG7xrHx2uLwwtWB9DytXKW2ZLfVP+q60iqGGN7CzlZCQbSNJPRVWlAO8ZqWMFbXWS3xxqE5rgvcyxU1BLKrqht9TS5oec67Kj0PcO+gI6MaZ9zDYUPEtnrfH6iIkFTHMFTmfkLLZ3gsOQDB4eEUvAh25w8p74qGiUTlGbq+6n9t+NOrztME4nkrG40M79/hgLbEqbZnHXRzu+APYwfks=) | ||
## πΏ Install & Usage | ||
@@ -150,14 +154,26 @@ | ||
This plugin provides three configs: | ||
<!-- begin auto-generated configs list --> | ||
| Name | Description | | ||
| :-- | :-- | | ||
| `plugin:n/recommended` | Considers both CommonJS and ES Modules. If [`"type":"module"` field](https://medium.com/@nodejs/announcing-a-new-experimental-modules-1be8d2d6c2ff#b023) existed in package.json then it considers files as ES Modules. Otherwise it considers files as CommonJS. In addition, it considers `*.mjs` files as ES Modules and `*.cjs` files as CommonJS. | | ||
| `plugin:n/recommended-module` | Considers all files as ES Modules. | | ||
| `plugin:n/recommended-script` | Considers all files as CommonJS. | | ||
| | Name | | ||
| :- | :------------------------ | | ||
| π | `flat/mixed-esm-and-cjs` | | ||
| βοΈ | `flat/recommended` | | ||
| π’ | `flat/recommended-module` | | ||
| β | `flat/recommended-script` | | ||
| βοΈ | `recommended` | | ||
| π’ | `recommended-module` | | ||
| β | `recommended-script` | | ||
<!-- end auto-generated configs list --> | ||
About each config: | ||
- `recommended`: Considers both CommonJS and ES Modules. If [`"type":"module"` field](https://medium.com/@nodejs/announcing-a-new-experimental-modules-1be8d2d6c2ff#b023) existed in package.json then it considers files as ES Modules. Otherwise it considers files as CommonJS. In addition, it considers `*.mjs` files as ES Modules and `*.cjs` files as CommonJS. | ||
- `recommended-module`: Considers all files as ES Modules. | ||
- `recommended-script`: Considers all files as CommonJS. | ||
These preset configs: | ||
- enable [no-process-exit](http://eslint.org/docs/rules/no-process-exit) rule because [the official document](https://nodejs.org/api/process.html#process_process_exit_code) does not recommend a use of `process.exit()`. | ||
- enable plugin rules which are given β in the above table. | ||
- enable plugin rules indicated by emojis in the [rules table](#-rules). | ||
- add `{ecmaVersion: 2021}` and etc into `parserOptions`. | ||
@@ -164,0 +180,0 @@ - add proper globals into `globals`. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
347584
23
9684
241
12
+ Addedglobals@^13.24.0
+ Addedglobals@13.24.0(transitive)
+ Addedtype-fest@0.20.2(transitive)
Updatedeslint-plugin-es-x@^7.5.0