mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
0861d9a5c8
Fix an incompatibility with `eslint-plugin-jsdoc`. It relies on properties of `context` being values rather than getters: https://github.com/gajus/eslint-plugin-jsdoc/blob/26276d428631a2625575607cba7875dab6797091/src/buildForbidRuleDefinition.js#L86-L103 When `options` property is a getter, this code throws an error because it attempts to define a property with both `value` and `get` in its descriptor. This PR replaces the `id` and `options` getters with value properties. The getters were there to prevent the `Context` object from being mutated by rule code, and allow the object to be frozen, as it is in ESLint. But each rule gets its own `Context` object, so if it chooses to mutate it, it only harms itself, and can't impact other rules/plugins. In ESLint, trying to alter the frozen `Context` object would be a hard error, so it's doubtful that any ESLint plugins do this anyway. This is no real downside to this change for us, so we might as well make the change, and fix `eslint-plugin-jsdoc` and any other plugins which may depend on ESLint's behavior here.
8.6 KiB
8.6 KiB
Exit code
1
stdout
x create-once-plugin(after-only): after hook: filename: <fixture>/files/1.js
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(after-only): after hook: id: create-once-plugin/after-only
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(always-run): after hook: filename: <fixture>/files/1.js
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(always-run): after hook: id: create-once-plugin/always-run
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(always-run): before hook: filename: <fixture>/files/1.js
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(always-run): before hook: id: create-once-plugin/always-run
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(always-run): createOnce: call count: 1
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(always-run): createOnce: cwd error: Cannot access `context.cwd` in `createOnce`
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(always-run): createOnce: filename error: Cannot access `context.filename` in `createOnce`
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(always-run): createOnce: getCwd() error: Cannot call `context.getCwd` in `createOnce`
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(always-run): createOnce: getFilename() error: Cannot call `context.getFilename` in `createOnce`
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(always-run): createOnce: getPhysicalFilename() error: Cannot call `context.getPhysicalFilename` in `createOnce`
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(always-run): createOnce: getSourceCode() error: Cannot call `context.getSourceCode` in `createOnce`
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(always-run): createOnce: id: null
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(always-run): createOnce: options: null
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(always-run): createOnce: parserOptions error: Cannot access `context.parserOptions` in `createOnce`
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(always-run): createOnce: parserPath error: Cannot access `context.parserPath` in `createOnce`
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(always-run): createOnce: physicalFilename error: Cannot access `context.physicalFilename` in `createOnce`
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(always-run): createOnce: report error: Cannot report errors in `createOnce`
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(always-run): createOnce: settings error: Cannot access `context.settings` in `createOnce`
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(always-run): createOnce: sourceCode error: Cannot access `context.sourceCode` in `createOnce`
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(always-run): createOnce: this === rule: true
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(before-only): before hook: filename: <fixture>/files/1.js
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(before-only): before hook: id: create-once-plugin/before-only
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(skip-run): before hook: filename: <fixture>/files/1.js
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(skip-run): before hook: id: create-once-plugin/skip-run
,-[files/1.js:1:1]
1 | let x;
: ^
`----
x create-once-plugin(after-only): ident visit fn "x": filename: <fixture>/files/1.js
,-[files/1.js:1:5]
1 | let x;
: ^
`----
x create-once-plugin(always-run): ident visit fn "x": filename: <fixture>/files/1.js
,-[files/1.js:1:5]
1 | let x;
: ^
`----
x create-once-plugin(before-only): ident visit fn "x": filename: <fixture>/files/1.js
,-[files/1.js:1:5]
1 | let x;
: ^
`----
x create-once-plugin(no-hooks): ident visit fn "x": filename: <fixture>/files/1.js
,-[files/1.js:1:5]
1 | let x;
: ^
`----
x create-once-plugin(after-only): after hook: filename: <fixture>/files/2.js
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(after-only): after hook: id: create-once-plugin/after-only
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(always-run): after hook: filename: <fixture>/files/2.js
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(always-run): after hook: id: create-once-plugin/always-run
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(always-run): before hook: filename: <fixture>/files/2.js
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(always-run): before hook: id: create-once-plugin/always-run
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(always-run): createOnce: call count: 1
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(always-run): createOnce: cwd error: Cannot access `context.cwd` in `createOnce`
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(always-run): createOnce: filename error: Cannot access `context.filename` in `createOnce`
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(always-run): createOnce: getCwd() error: Cannot call `context.getCwd` in `createOnce`
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(always-run): createOnce: getFilename() error: Cannot call `context.getFilename` in `createOnce`
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(always-run): createOnce: getPhysicalFilename() error: Cannot call `context.getPhysicalFilename` in `createOnce`
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(always-run): createOnce: getSourceCode() error: Cannot call `context.getSourceCode` in `createOnce`
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(always-run): createOnce: id: null
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(always-run): createOnce: options: null
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(always-run): createOnce: parserOptions error: Cannot access `context.parserOptions` in `createOnce`
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(always-run): createOnce: parserPath error: Cannot access `context.parserPath` in `createOnce`
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(always-run): createOnce: physicalFilename error: Cannot access `context.physicalFilename` in `createOnce`
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(always-run): createOnce: report error: Cannot report errors in `createOnce`
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(always-run): createOnce: settings error: Cannot access `context.settings` in `createOnce`
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(always-run): createOnce: sourceCode error: Cannot access `context.sourceCode` in `createOnce`
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(always-run): createOnce: this === rule: true
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(before-only): before hook: filename: <fixture>/files/2.js
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(before-only): before hook: id: create-once-plugin/before-only
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(skip-run): before hook: filename: <fixture>/files/2.js
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(skip-run): before hook: id: create-once-plugin/skip-run
,-[files/2.js:1:1]
1 | let y;
: ^
`----
x create-once-plugin(after-only): ident visit fn "y": filename: <fixture>/files/2.js
,-[files/2.js:1:5]
1 | let y;
: ^
`----
x create-once-plugin(always-run): ident visit fn "y": filename: <fixture>/files/2.js
,-[files/2.js:1:5]
1 | let y;
: ^
`----
x create-once-plugin(before-only): ident visit fn "y": filename: <fixture>/files/2.js
,-[files/2.js:1:5]
1 | let y;
: ^
`----
x create-once-plugin(no-hooks): ident visit fn "y": filename: <fixture>/files/2.js
,-[files/2.js:1:5]
1 | let y;
: ^
`----
Found 0 warnings and 60 errors.
Finished in Xms on 2 files with 6 rules using X threads.
stderr