Repository navigation
Move to ESLint 9 and flat config - #11
Draft
alistair3149 wants to merge 1 commit into
Draft
alistair3149 wants to merge 1 commit into
alistair3149 wants to merge 1 commit into
Conversation
eslint-config-wikimedia 0.33.1 supports ESLint 9 and flat config (T364065). This moves the extension onto them. Lint now passes with three warnings; on master it failed on a test fixture's indentation. - Bump eslint-config-wikimedia 0.28.2 → 0.33.1 and grunt-eslint 24.3.0 → 26.0.0, and declare eslint 9.39.5, which eslint.config.js loads directly. grunt-eslint 27 bundles ESLint 10, which eslint-config-wikimedia does not support yet. - Replace .eslintrc.json with eslint.config.js. - eslint-config-wikimedia no longer has an ES5 browser config (`client-es5`), and MediaWiki 1.40, which this extension supports, still serves JavaScript to ES5 browsers. modules/ now gets the shared client rules (`client/common`) with ecmaVersion 5: ES2015+ syntax and globals are still errors, but ES2015+ methods such as Object.assign or String.prototype.includes are no longer reported. - Gruntfile.js and eslint.config.js run in Node, so they get the server config instead of the client one. Gruntfile.js gets the 'use strict' that config requires, in place of an `/* eslint-env */` comment ESLint 9 ignores, and `const` for its one variable. - Drop the `jQuery` global, which the jquery config now defines. - Keep the opensearch request in a variable and attach its handler with .then(), as no-jquery/no-done-fail asks. Chaining .then() would store a new promise without the abort() that cancel needs. - Reindent the JSON test fixture with tabs and add codecov.yml's final newline. The fixture's JSON is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
eslint-config-wikimedia 0.33.1 supports ESLint 9 and flat config (T364065). This moves the extension onto them. Lint now passes with three warnings; on master it failed on a test fixture's indentation.
Human input
Goal and shape: goal from @alistair3149; shape Claude's.
Outcome: not reviewed by a human yet. Left for you: the ES5 call below, and a try of the page name suggestions, which no test covers.
Claude's calls
modules/as ES5 withclient/common, rather than moving the code toclient/es6.eslintnpm script.Gruntfile.jsandeslint.config.js..then(), rather than keeping.done()with a disable comment.npm test(NODE_JSis commented out in the Makefile), so it does not check this change either.client/es6and ES2015 syntax. Keeping 1.40,eslint-plugin-es-x'srestrict-to-es5preset would bring back the 139 checks for newer built-ins this PR loses..then(), the suggestions callback runs one tick later, and an exception inside it is logged by jQuery as a console warning instead of surfacing as an uncaught error.Changes
eslint-config-wikimedia0.28.2 → 0.33.1 andgrunt-eslint24.3.0 → 26.0.0, and declareeslint9.39.5, whicheslint.config.jsloads directly. grunt-eslint 27 bundles ESLint 10, which eslint-config-wikimedia does not support yet..eslintrc.jsonwitheslint.config.js.client-es5), and MediaWiki 1.40, which this extension supports, still serves JavaScript to ES5 browsers.modules/now gets the shared client rules (client/common) withecmaVersion5: ES2015+ syntax and globals are still errors, but ES2015+ methods such asObject.assignorString.prototype.includesare no longer reported.Gruntfile.jsandeslint.config.jsrun in Node, so they get the server config instead of the client one.Gruntfile.jsgets the'use strict'that config requires, in place of an/* eslint-env */comment ESLint 9 ignores, andconstfor its one variable.jQueryglobal, which the jquery config now defines..then(), asno-jquery/no-done-failasks. Chaining.then()would store a new promise without theabort()thatcancelneeds.codecov.yml's final newline. The fixture's JSON is unchanged.Not in this PR: running
npm testin CI, and the PHPUnit fatal error CI hits on master and here: SMW now declaresgetTestCaseLocation(): string, whichJsonTestCaseScriptRunnerTestdoes not match.Verification evidence
npm testfails. 130 files, 90 errors (88indentin the fixture, 1no-mixed-spaces-and-tabsincomposer.json, 1eol-lastincodecov.yml), 3 warnings (2max-len, 1no-jquery/no-global-selector)..eslintrc.jsonandmodules/onclient/commonat ES5: the same, plus 1no-jquery/no-done-fail.npm testpasses. ESLint lints the same 130 files, witheslint.config.jsin place of.eslintrc.json: 0 errors, the same 3 warnings. Thecomposer.jsonerror is gone because ESLint 9 droppedno-mixed-spaces-and-tabs.--print-configfrom ESLint 8 (config bump alone) and ESLint 9:modules/createPage.searchSuggest.js: rules, globals,ecmaVersion,sourceType, parser and settings match, apart from ESLint 9's owneslint:recommendedchanges (addedno-empty-static-block,no-new-native-nonconstructor,no-unused-private-class-members; droppedno-extra-semi,no-mixed-spaces-and-tabs,no-new-symbol);Gruntfile.js: client → server config;ecmaVersion; no effect.client-es5against this branch, formodules/createPage.searchSuggest.js:ecmaVersion5 in both; dropped 139es-xrules,no-restricted-properties(parentElement) andno-restricted-syntax(Arraykeys()/values()); added 13 rules from the newer config.npm cifrom the new lockfile: one ESLint copy (9.39.5), no invalid dependencies.JsonTestCaseScriptRunnerTest.php, which this PR does not touch. master's last run, on 31 August, hit the same error in its MediaWiki 1.44 job.