-
Notifications
You must be signed in to change notification settings - Fork 21
Upgrade to ESLint 9 #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
0888832
4e064c8
b282bab
399dd1a
4674271
65e6470
5c13678
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
* text=auto eol=lf |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
npm-debug.log | ||
package-lock.json | ||
yarn.lock | ||
.idea | ||
/test/fixtures |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import fs from "node:fs/promises"; | ||
import path from "node:path"; | ||
|
||
const fixtures = path.join( ".", "test", "fixtures" ); | ||
|
||
try { | ||
await fs.mkdir( fixtures ); | ||
} catch ( _ ) { | ||
await fs.rm( | ||
fixtures, | ||
{ | ||
recursive: true | ||
} | ||
); | ||
} | ||
|
||
await fs.cp( | ||
path.join( ".", "node_modules", "jquery", "src" ), | ||
path.join( fixtures, "src" ), | ||
{ | ||
recursive: true | ||
} | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import jquery from "./index.js"; | ||
import globals from "globals"; | ||
import stylistic from "@stylistic/eslint-plugin-js"; | ||
|
||
export default [ | ||
jquery, | ||
{ | ||
files: [ "!test/**" ], | ||
plugins: { | ||
"@stylistic/js": stylistic | ||
}, | ||
rules: { | ||
"@stylistic/js/indent": [ "error", "tab" ], | ||
"@stylistic/js/quote-props": [ "error", "as-needed" ] | ||
} | ||
}, | ||
{ | ||
files: [ "test/**" ], | ||
languageOptions: { | ||
globals: { | ||
...globals.amd, | ||
...globals.browser | ||
} | ||
} | ||
} | ||
]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,11 @@ | |
"version": "3.0.2", | ||
"description": "jQuery eslint config", | ||
"main": "index.js", | ||
"type": "module", | ||
"scripts": { | ||
"test": "eslint ." | ||
"test": "npm run copy-fixtures && npm run lint", | ||
"lint": "eslint", | ||
"copy-fixtures": "node copy-fixtures.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
|
@@ -25,7 +28,14 @@ | |
], | ||
"author": "Gaidarenko Oleg <markelog@gmail.com>", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@stylistic/eslint-plugin-js": "^2.9.0" | ||
}, | ||
"peerDependencies": { | ||
"eslint": ">=9.0.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^8.5.0" | ||
"eslint": "^9.12.0", | ||
"jquery": "latest" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer to provide a concrete version here, even without the |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,11 +6,19 @@ | |
npm install --save-dev eslint-config-jquery | ||
``` | ||
|
||
Configure ESLint with a `.eslintrc` file using the following contents: | ||
```json | ||
{ | ||
"extends": "jquery" | ||
} | ||
Version 4.0.0 or newer work with ESLint version 9.0.0 or newer and require using the flat config. Use version 3.x for older ESLint versions. | ||
|
||
In your `eslint.config file`, import it and add it to your flat config array. | ||
|
||
```javascript | ||
import jquery from "eslint-config-jquery"; | ||
|
||
export default [ | ||
// ... any other configurations, | ||
jquery, | ||
// ... any other configurations | ||
]; | ||
Comment on lines
+16
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @timmywil that's probably a good idea; the way we use the config is too "picky"; we should perhaps just apply it on a global level and then provide overrides in separate blocks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At my workplace, we use eslint-config-jquery as one of the base sets of rules, then override a handful of them that we disagree with. It looks like this:
|
||
|
||
``` | ||
|
||
## Status | ||
|
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.