| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2191,6 +2191,8 @@ const timedImport = performance.timerify(async (module) => { | |||
| 2191 | 2191 | await timedImport('some-module'); | |
| 2192 | 2192 | ``` | |
| 2193 | 2193 | ||
| 2194 | + <!-- eslint-disable no-global-assign --> | ||
| 2195 | + | ||
| 2194 | 2196 | ```cjs | |
| 2195 | 2197 | 'use strict'; | |
| 2196 | 2198 | const { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -412,6 +412,8 @@ To load modules from the file system in the injected main script, users can | |||
| 412 | 412 | create a `require` function that can load from the file system using | |
| 413 | 413 | `module.createRequire()`. For example, in a CommonJS entry point: | |
| 414 | 414 | ||
| 415 | + <!-- eslint-disable no-global-assign --> | ||
| 416 | + | ||
| 415 | 417 | ```js | |
| 416 | 418 | const { createRequire } = require('node:module'); | |
| 417 | 419 | require = createRequire(__filename); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -85,10 +85,9 @@ export default [ | |||
| 85 | 85 | js.configs.recommended, | |
| 86 | 86 | jsdoc.configs['flat/recommended'], | |
| 87 | 87 | { | |
| 88 | - files: ['**/*.{js,cjs}'], | ||
| 88 | + files: ['**/*.js'], | ||
| 89 | 89 | languageOptions: { | |
| 90 | - // The default is `commonjs` but it's not supported by the Babel parser. | ||
| 91 | - sourceType: 'script', | ||
| 90 | + sourceType: 'commonjs', | ||
| 92 | 91 | }, | |
| 93 | 92 | }, | |
| 94 | 93 | { | |
@@ -101,7 +100,6 @@ export default [ | |||
| 101 | 100 | parser: babelEslintParser, | |
| 102 | 101 | parserOptions: { | |
| 103 | 102 | babelOptions: { | |
| 104 | - parserOpts: { createImportExpressions: true }, | ||
| 105 | 103 | plugins: [ | |
| 106 | 104 | babelPluginSyntaxImportSource, | |
| 107 | 105 | ], | |
@@ -229,6 +227,7 @@ export default [ | |||
| 229 | 227 | ...noRestrictedSyntaxCommonLib, | |
| 230 | 228 | ], | |
| 231 | 229 | 'no-self-compare': 'error', | |
| 230 | + 'no-shadow-restricted-names': ['error', { reportGlobalThis: false }], | ||
| 232 | 231 | 'no-template-curly-in-string': 'error', | |
| 233 | 232 | 'no-throw-literal': 'error', | |
| 234 | 233 | 'no-undef': ['error', { typeof: true }], | |
@@ -256,6 +255,7 @@ export default [ | |||
| 256 | 255 | ||
| 257 | 256 | // ESLint recommended rules that we disable. | |
| 258 | 257 | 'no-inner-declarations': 'off', | |
| 258 | + 'no-useless-assignment': 'off', | ||
| 259 | 259 | ||
| 260 | 260 | // JSDoc rules. | |
| 261 | 261 | 'jsdoc/require-jsdoc': 'off', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1798,8 +1798,6 @@ Module.prototype._compile = function(content, filename, format) { | |||
| 1798 | 1798 | } | |
| 1799 | 1799 | } | |
| 1800 | 1800 | ||
| 1801 | - let redirects; | ||
| 1802 | - | ||
| 1803 | 1801 | let compiledWrapper; | |
| 1804 | 1802 | if (format !== 'module') { | |
| 1805 | 1803 | const result = wrapSafe(filename, content, this, format); | |
@@ -1815,7 +1813,7 @@ Module.prototype._compile = function(content, filename, format) { | |||
| 1815 | 1813 | } | |
| 1816 | 1814 | ||
| 1817 | 1815 | const dirname = path.dirname(filename); | |
| 1818 | - const require = makeRequireFunction(this, redirects); | ||
| 1816 | + const require = makeRequireFunction(this); | ||
| 1819 | 1817 | let result; | |
| 1820 | 1818 | const exports = this.exports; | |
| 1821 | 1819 | const thisValue = exports; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -154,7 +154,7 @@ function generateSEA(fixtureDir, options = {}) { | |||
| 154 | 154 | } catch (e) { | |
| 155 | 155 | const message = `Cannot copy ${process.execPath} to ${outputFile}: ${inspect(e)}`; | |
| 156 | 156 | if (verifyWorkflow) { | |
| 157 | - throw new Error(message); | ||
| 157 | + throw new Error(message, { cause: e }); | ||
| 158 | 158 | } | |
| 159 | 159 | common.skip(message); | |
| 160 | 160 | } | |
@@ -192,7 +192,7 @@ function generateSEA(fixtureDir, options = {}) { | |||
| 192 | 192 | } catch (e) { | |
| 193 | 193 | const message = `Cannot inject ${seaPrepBlob} into ${outputFile}: ${inspect(e)}`; | |
| 194 | 194 | if (verifyWorkflow) { | |
| 195 | - throw new Error(message); | ||
| 195 | + throw new Error(message, { cause: e }); | ||
| 196 | 196 | } | |
| 197 | 197 | common.skip(message); | |
| 198 | 198 | } | |
@@ -210,7 +210,7 @@ function signSEA(targetExecutable, verifyWorkflow = false) { | |||
| 210 | 210 | } catch (e) { | |
| 211 | 211 | const message = `Cannot sign ${targetExecutable}: ${inspect(e)}`; | |
| 212 | 212 | if (verifyWorkflow) { | |
| 213 | - throw new Error(message); | ||
| 213 | + throw new Error(message, { cause: e }); | ||
| 214 | 214 | } | |
| 215 | 215 | common.skip(message); | |
| 216 | 216 | } | |
@@ -221,7 +221,7 @@ function signSEA(targetExecutable, verifyWorkflow = false) { | |||
| 221 | 221 | } catch (e) { | |
| 222 | 222 | const message = `Cannot find signtool: ${inspect(e)}`; | |
| 223 | 223 | if (verifyWorkflow) { | |
| 224 | - throw new Error(message); | ||
| 224 | + throw new Error(message, { cause: e }); | ||
| 225 | 225 | } | |
| 226 | 226 | common.skip(message); | |
| 227 | 227 | } | |
@@ -232,7 +232,7 @@ function signSEA(targetExecutable, verifyWorkflow = false) { | |||
| 232 | 232 | } catch (e) { | |
| 233 | 233 | const message = `Cannot sign ${targetExecutable}: ${inspect(e)}\n${stderr}`; | |
| 234 | 234 | if (verifyWorkflow) { | |
| 235 | - throw new Error(message); | ||
| 235 | + throw new Error(message, { cause: e }); | ||
| 236 | 236 | } | |
| 237 | 237 | common.skip(message); | |
| 238 | 238 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -147,6 +147,7 @@ describe('Module syntax detection', { concurrency: !process.env.TEST_PARALLEL }, | |||
| 147 | 147 | } | |
| 148 | 148 | ||
| 149 | 149 | it('should not hint wrong format in resolve hook', async () => { | |
| 150 | + // eslint-disable-next-line no-unassigned-vars | ||
| 150 | 151 | let writeSync; | |
| 151 | 152 | const { stdout, stderr, code, signal } = await spawnPromisified(process.execPath, [ | |
| 152 | 153 | '--no-warnings', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,7 @@ module.exports = { | |||
| 15 | 15 | }, | |
| 16 | 16 | ||
| 17 | 17 | create(context) { | |
| 18 | - const sourceCode = context.getSourceCode(); | ||
| 18 | + const sourceCode = context.sourceCode; | ||
| 19 | 19 | ||
| 20 | 20 | // Helper function: Checks if two nodes have identical tokens | |
| 21 | 21 | function equalTokens(left, right) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,12 +49,13 @@ module.exports = { | |||
| 49 | 49 | // The common module should be loaded in the first place. | |
| 50 | 50 | const notLoadedFirst = foundModules.indexOf(requiredModule) !== 0; | |
| 51 | 51 | if (notLoadedFirst) { | |
| 52 | - context.report( | ||
| 53 | - node, | ||
| 54 | - 'Mandatory module "{{moduleName}}" must be loaded ' + | ||
| 55 | - 'before any other modules.', | ||
| 56 | - { moduleName: requiredModule }, | ||
| 57 | - ); | ||
| 52 | + context.report({ | ||
| 53 | + node: node.body[0] ?? node, | ||
| 54 | + message: | ||
| 55 | + 'Mandatory module "{{moduleName}}" must be loaded ' + | ||
| 56 | + 'before any other modules.', | ||
| 57 | + data: { moduleName: requiredModule }, | ||
| 58 | + }); | ||
| 58 | 59 | } | |
| 59 | 60 | }, | |
| 60 | 61 | }; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -66,11 +66,11 @@ module.exports = { | |||
| 66 | 66 | ([module]) => foundModules.indexOf(module) === -1, | |
| 67 | 67 | ); | |
| 68 | 68 | missingModules.forEach(([moduleName]) => { | |
| 69 | - context.report( | ||
| 70 | - node, | ||
| 71 | - 'Mandatory module "{{moduleName}}" must be loaded.', | ||
| 72 | - { moduleName: moduleName }, | ||
| 73 | - ); | ||
| 69 | + context.report({ | ||
| 70 | + node: node.body[0] ?? node, | ||
| 71 | + message: 'Mandatory module "{{moduleName}}" must be loaded.', | ||
| 72 | + data: { moduleName: moduleName }, | ||
| 73 | + }); | ||
| 74 | 74 | }); | |
| 75 | 75 | } | |
| 76 | 76 | }, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments