Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
💥 update node/recommended
- Loading branch information
1 parent
9006518
commit 2061413
Showing
14 changed files
with
344 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
"use strict" | ||
|
||
module.exports = { | ||
commonGlobals: { | ||
// ECMAScript | ||
ArrayBuffer: "readonly", | ||
Atomics: "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) | ||
BigInt: "readonly", | ||
BigInt64Array: "readonly", | ||
BigUint64Array: "readonly", | ||
globalThis: "readonly", | ||
|
||
// ECMA-404 | ||
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: { | ||
"no-process-exit": "error", | ||
"node/no-deprecated-api": "error", | ||
"node/no-extraneous-require": "error", | ||
"node/no-missing-require": "error", | ||
"node/no-unpublished-bin": "error", | ||
"node/no-unpublished-require": "error", | ||
"node/no-unsupported-features/es-builtins": "error", | ||
"node/no-unsupported-features/es-syntax": "error", | ||
"node/no-unsupported-features/node-builtins": "error", | ||
"node/process-exit-as-throw": "error", | ||
"node/shebang": "error", | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"use strict" | ||
|
||
const { commonGlobals, commonRules } = require("./_commons") | ||
|
||
module.exports = { | ||
globals: { | ||
...commonGlobals, | ||
__dirname: "off", | ||
__filename: "off", | ||
exports: "off", | ||
module: "off", | ||
require: "off", | ||
}, | ||
parserOptions: { | ||
ecmaFeatures: { globalReturn: false }, | ||
ecmaVersion: 2019, | ||
sourceType: "module", | ||
}, | ||
plugins: ["node"], | ||
rules: { | ||
...commonRules, | ||
"node/no-extraneous-import": "error", | ||
"node/no-missing-import": "error", | ||
"node/no-unpublished-import": "error", | ||
"node/no-unsupported-features/es-syntax": [ | ||
"error", | ||
{ ignores: ["modules"] }, | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"use strict" | ||
|
||
const { commonGlobals, commonRules } = require("./_commons") | ||
|
||
module.exports = { | ||
globals: { | ||
...commonGlobals, | ||
__dirname: "readonly", | ||
__filename: "readonly", | ||
exports: "readonly", | ||
module: "readonly", | ||
require: "readonly", | ||
}, | ||
parserOptions: { | ||
ecmaFeatures: { globalReturn: true }, | ||
ecmaVersion: 2019, | ||
sourceType: "script", | ||
}, | ||
plugins: ["node"], | ||
rules: { | ||
...commonRules, | ||
"node/no-extraneous-import": "off", | ||
"node/no-missing-import": "off", | ||
"node/no-unpublished-import": "off", | ||
"node/no-unsupported-features/es-syntax": ["error", { ignores: [] }], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"use strict" | ||
|
||
const getPackageJson = require("../util/get-package-json") | ||
const moduleConfig = require("./recommended-module") | ||
const scriptConfig = require("./recommended-script") | ||
|
||
module.exports = () => { | ||
const packageJson = getPackageJson() | ||
const isModule = (packageJson && packageJson.type) === "module" | ||
|
||
return { | ||
...(isModule ? moduleConfig : scriptConfig), | ||
overrides: [ | ||
{ files: ["*.cjs", ".*.cjs"], ...scriptConfig }, | ||
{ files: ["*.mjs", ".*.mjs"], ...moduleConfig }, | ||
], | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "module" | ||
} |
Oops, something went wrong.