Skip to content

Commit 177a558

Browse files
committed
feat: support Eslint 9
1 parent 3a3f16e commit 177a558

26 files changed

+563
-438
lines changed

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist/
2+
node_modules/

.eslintrc.json

-4
This file was deleted.

.vscode/settings.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
{
2-
"cSpell.words": [
3-
"astrojs",
4-
"Globified",
5-
"globify"
6-
],
2+
"cSpell.words": ["astrojs", "Globified", "globify"],
73
"explorer.fileNesting.patterns": {
84
"index.js": "*.js"
95
}

eslint.config.cjs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const config = require("./index.js")
2+
module.exports = config

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@
3434
"@typescript-eslint/eslint-plugin": "7.13.0",
3535
"@typescript-eslint/parser": "7.13.0",
3636
"anymatch": "^3.1.3",
37-
"eslint": "^8.57.0",
37+
"eslint": "^9.4.0",
3838
"eslint-config-prettier": "^9.1.0",
39-
"eslint-plugin-astro": "^0.34.0",
39+
"eslint-plugin-astro": "^1.2.2",
4040
"eslint-plugin-html": "^8.1.1",
4141
"eslint-plugin-import": "^2.29.1",
42-
"eslint-plugin-json": "^3.1.0",
42+
"eslint-plugin-json": "^4.0.0",
4343
"eslint-plugin-node": "^11.1.0",
4444
"eslint-plugin-only-warn": "npm:@aminya/eslint-plugin-only-warn@^1.2.2",
4545
"eslint-plugin-optimize-regex": "^1.2.1",
4646
"eslint-plugin-react": "^7.34.2",
4747
"eslint-plugin-solid": "^0.14.0",
48-
"eslint-plugin-yaml": "^0.5.0",
48+
"eslint-plugin-yaml": "^1.0.0",
4949
"globify-gitignore": "^1.0.3",
5050
"make-synchronous": "^0.1.1",
5151
"prettier": "3.3.2",
@@ -65,7 +65,7 @@
6565
"@types/shelljs": "^0.8.15",
6666
"eslint-config-atomic": "link:",
6767
"execa": "^5.1.1",
68-
"gitly": "^2.5.3",
68+
"gitly": "^3.0.0",
6969
"npm-check-updates": "16.14.20",
7070
"prettier-config-atomic": "^4.0.0",
7171
"shelljs": "^0.8.5",

pnpm-lock.yaml

+252-273
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

prettier.config.mjs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import config from "prettier-config-atomic"
2+
export default config

src/astro.cts

+20-12
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
1-
import { Linter } from "eslint"
1+
import type { Linter } from "eslint"
22
import { pluginImportAstroRulesExtra } from "./plugin-import-rules.cjs"
3+
import astroPlugin from "eslint-plugin-astro"
4+
import * as onlyWarnPlugin from "eslint-plugin-only-warn"
5+
import astroParser from "astro-eslint-parser"
36

4-
export const astroConfig: Linter.ConfigOverride<Linter.RulesRecord> = {
7+
export const astroConfig: Linter.FlatConfig<Linter.RulesRecord> = {
58
// astro files
9+
...astroPlugin.configs.recommended,
610
files: ["*.astro"],
7-
parser: "astro-eslint-parser",
8-
parserOptions: {
9-
parser: "@typescript-eslint/parser",
10-
extraFileExtensions: [".astro"],
11+
languageOptions: {
12+
parser: astroParser,
13+
parserOptions: {
14+
parser: "@typescript-eslint/parser",
15+
extraFileExtensions: [".astro"],
16+
},
17+
globals: {
18+
astroHTML: "readonly",
19+
},
1120
},
12-
plugins: ["astro", "only-warn"],
13-
extends: ["plugin:astro/recommended"],
14-
rules: {
15-
...pluginImportAstroRulesExtra
21+
plugins: {
22+
astro: astroPlugin,
23+
"only-warn": onlyWarnPlugin,
1624
},
17-
globals: {
18-
astroHTML: "readonly",
25+
rules: {
26+
...pluginImportAstroRulesExtra,
1927
},
2028
}

src/coffeescript.cts

+18-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
import { pluginNodeRules } from "./plugin-node-rules.cjs"
22
import { pluginImportRulesExtra } from "./plugin-import-rules.cjs"
3-
import { Linter } from "eslint"
3+
import type { Linter } from "eslint"
4+
import * as eslintPluginCoffee from "eslint-plugin-coffee"
5+
import * as onlyWarnPlugin from "eslint-plugin-only-warn"
6+
import * as nodePlugin from "eslint-plugin-node"
7+
import * as coffeeParser from "eslint-plugin-coffee/parser"
8+
import * as optimizeRegexPlugin from "eslint-plugin-optimize-regex"
49

5-
export const coffeeConfig: Linter.ConfigOverride<Linter.RulesRecord> = {
10+
export const coffeeConfig: Linter.FlatConfig<Linter.RulesRecord> = {
611
// CoffeeScript files
12+
...eslintPluginCoffee.configs!.recommended,
13+
...optimizeRegexPlugin.configs!.all,
14+
...eslintPluginCoffee.configs!.prettier,
715
files: ["**/*.coffee"],
8-
parser: "eslint-plugin-coffee",
9-
plugins: ["coffee", "node", "only-warn"],
10-
extends: ["plugin:coffee/eslint-recommended", "plugin:optimize-regex/all", "plugin:coffee/prettier"],
16+
languageOptions: {
17+
parser: coffeeParser,
18+
},
19+
plugins: {
20+
coffee: eslintPluginCoffee,
21+
node: nodePlugin,
22+
"only-warn": onlyWarnPlugin,
23+
},
1124
rules: {
1225
...pluginNodeRules,
1326
...pluginImportRulesExtra,

src/cson.cts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { Linter } from "eslint"
1+
import type { Linter } from "eslint"
22
import { coffeeConfig } from "./coffeescript.cjs"
33

4-
export const csonConfig: Linter.ConfigOverride<Linter.RulesRecord> = {
4+
export const csonConfig: Linter.FlatConfig<Linter.RulesRecord> = {
55
...coffeeConfig,
66
files: ["**/*.cson"],
77
rules: {

src/html.cts

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { Linter } from "eslint"
1+
import type { Linter } from "eslint"
2+
import * as htmlPlugin from "eslint-plugin-html"
23

3-
export const htmlConfig: Linter.ConfigOverride<Linter.RulesRecord> = {
4+
export const htmlConfig: Linter.FlatConfig<Linter.RulesRecord> = {
45
files: [
56
"**/*.erb",
67
"**/*.handlebars",
@@ -16,5 +17,7 @@ export const htmlConfig: Linter.ConfigOverride<Linter.RulesRecord> = {
1617
"**/*.xhtml",
1718
"**/*.xml",
1819
],
19-
plugins: ["html"],
20+
plugins: {
21+
html: htmlPlugin,
22+
},
2023
}

src/index-react.cts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { Linter } from "eslint"
1+
import type { Linter } from "eslint"
22
import base from "./index.cjs"
33
import { tsConfig } from "./typescript.cjs"
44

5-
const nonStrictConfig: Linter.Config = {
5+
const nonStrictConfig: Linter.FlatConfig = {
66
...base,
77
plugins: ["react", ...(base.plugins ?? [])],
88
extends: ["plugin:react/recommended", ...(base.extends ?? [])],

src/index-solid.cts

+18-20
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
1-
import { Linter } from "eslint"
1+
import type { Linter } from "eslint"
22
import base from "./index.cjs"
33
import { tsConfig } from "./typescript.cjs"
44

5-
const nonStrictConfig: Linter.Config = {
5+
const nonStrictConfig: Linter.FlatConfig[] = [
66
...base,
7-
overrides: [
8-
// JavaScript:
9-
{
10-
files: ["*.js", "*.jsx", "*.mjs", "*.cjs"],
11-
plugins: ["solid", ...(base.plugins ?? [])],
12-
extends: ["plugin:solid/recommended", ...(base.extends ?? [])],
13-
},
14-
// TypeScript:
15-
{
16-
...tsConfig,
17-
plugins: ["solid", ...(tsConfig.plugins ?? [])],
18-
extends: ["plugin:solid/typescript", ...(tsConfig.extends ?? [])],
19-
rules: tsConfig.rules,
20-
},
21-
// The rest is the same
22-
...(base.overrides?.slice(1) ?? []),
23-
],
24-
}
7+
// JavaScript:
8+
{
9+
files: ["*.js", "*.jsx", "*.mjs", "*.cjs"],
10+
plugins: ["solid", ...(base.plugins ?? [])],
11+
extends: ["plugin:solid/recommended", ...(base.extends ?? [])],
12+
},
13+
// TypeScript:
14+
{
15+
...tsConfig,
16+
plugins: ["solid", ...(tsConfig.plugins ?? [])],
17+
extends: ["plugin:solid/typescript", ...(tsConfig.extends ?? [])],
18+
rules: tsConfig.rules,
19+
},
20+
// The rest is the same
21+
...(base.overrides?.slice(1) ?? []),
22+
]
2523

2624
export default nonStrictConfig

src/index-strict-react.cts

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import nonStrictConfig from "./index-react.cjs"
22

3-
// remove only-warn from javascript
4-
if (
5-
nonStrictConfig.plugins !== undefined &&
6-
nonStrictConfig.plugins[nonStrictConfig.plugins.length - 1] === "only-warn"
7-
) {
8-
nonStrictConfig.plugins.pop()
9-
}
3+
// // remove only-warn from javascript
4+
// if (
5+
// nonStrictConfig.plugins !== undefined &&
6+
// nonStrictConfig.plugins[nonStrictConfig.plugins.length - 1] === "only-warn"
7+
// ) {
8+
// nonStrictConfig.plugins.pop()
9+
// }
1010

11-
// remove only-warn from overrides
12-
nonStrictConfig.overrides?.forEach((overrides) => {
13-
if (overrides.plugins !== undefined && overrides.plugins[overrides.plugins.length - 1] === "only-warn") {
14-
overrides.plugins.pop()
15-
}
16-
})
11+
// // remove only-warn from overrides
12+
// nonStrictConfig.overrides?.forEach((overrides) => {
13+
// if (overrides.plugins !== undefined && overrides.plugins[overrides.plugins.length - 1] === "only-warn") {
14+
// overrides.plugins.pop()
15+
// }
16+
// })
1717

1818
export default nonStrictConfig

src/index-strict-solid.cts

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import nonStrictConfig from "./index-solid.cjs"
22

3-
// remove only-warn from javascript
4-
if (
5-
nonStrictConfig.plugins !== undefined &&
6-
nonStrictConfig.plugins[nonStrictConfig.plugins.length - 1] === "only-warn"
7-
) {
8-
nonStrictConfig.plugins.pop()
9-
}
3+
// // remove only-warn from javascript
4+
// if (
5+
// nonStrictConfig.plugins !== undefined &&
6+
// nonStrictConfig.plugins[nonStrictConfig.plugins.length - 1] === "only-warn"
7+
// ) {
8+
// nonStrictConfig.plugins.pop()
9+
// }
1010

11-
// remove only-warn from overrides
12-
nonStrictConfig.overrides?.forEach((overrides) => {
13-
if (overrides.plugins !== undefined && overrides.plugins[overrides.plugins.length - 1] === "only-warn") {
14-
overrides.plugins.pop()
15-
}
16-
})
11+
// // remove only-warn from overrides
12+
// nonStrictConfig.overrides?.forEach((overrides) => {
13+
// if (overrides.plugins !== undefined && overrides.plugins[overrides.plugins.length - 1] === "only-warn") {
14+
// overrides.plugins.pop()
15+
// }
16+
// })
1717

1818
export default nonStrictConfig

src/index-strict.cts

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import nonStrictConfig from "./index.cjs"
22

3-
// remove only-warn from javascript
4-
if (
5-
nonStrictConfig.plugins !== undefined &&
6-
nonStrictConfig.plugins[nonStrictConfig.plugins.length - 1] === "only-warn"
7-
) {
8-
nonStrictConfig.plugins.pop()
9-
}
3+
// // remove only-warn from javascript
4+
// if (
5+
// nonStrictConfig.plugins !== undefined &&
6+
// nonStrictConfig.plugins[nonStrictConfig.plugins.length - 1] === "only-warn"
7+
// ) {
8+
// nonStrictConfig.plugins.pop()
9+
// }
1010

11-
// remove only-warn from overrides
12-
nonStrictConfig.overrides?.forEach((overrides) => {
13-
if (overrides.plugins !== undefined && overrides.plugins[overrides.plugins.length - 1] === "only-warn") {
14-
overrides.plugins.pop()
15-
}
16-
})
11+
// // remove only-warn from overrides
12+
// nonStrictConfig.overrides?.forEach((overrides) => {
13+
// if (overrides.plugins !== undefined && overrides.plugins[overrides.plugins.length - 1] === "only-warn") {
14+
// overrides.plugins.pop()
15+
// }
16+
// })
1717

1818
export default nonStrictConfig

src/index.cts

+22-21
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import { jsConfig } from "./javascript.cjs"
22
import { tsConfig } from "./typescript.cjs"
3-
import { coffeeConfig } from "./coffeescript.cjs"
43
import { jsonConfig } from "./json.cjs"
5-
import { csonConfig } from "./cson.cjs"
64
import { yamlConfig } from "./yaml.cjs"
75
import { htmlConfig } from "./html.cjs"
8-
import { pluginImportSettings } from "./plugin-import-rules.cjs"
6+
// import { pluginImportSettings } from "./plugin-import-rules.cjs"
97
import semverMajor from "semver/functions/major"
108
import { getEslintVersion } from "./eslint-version.cjs"
119
import { astroConfig } from "./astro.cjs"
@@ -17,6 +15,9 @@ function maybeAddCoffeeScript() {
1715
// check if the eslint version is < 8
1816
// and if coffee installed
1917
if (eslintVersion < 8 && require.resolve("eslint-plugin-coffee")) {
18+
const coffeeConfig = require("./coffee.cjs").coffeeConfig
19+
const csonConfig = require("./cson.cjs").csonConfig
20+
2021
// if so try adding the coffee plugin
2122
return [coffeeConfig, csonConfig]
2223
}
@@ -26,23 +27,23 @@ function maybeAddCoffeeScript() {
2627
return []
2728
}
2829

29-
const config: Linter.Config = {
30-
root: true,
31-
env: {
32-
atomtest: true,
33-
es6: true,
34-
node: true,
35-
browser: true,
36-
},
37-
globals: {
38-
atom: "readonly",
39-
},
40-
ignorePatterns: ["node_modules/"],
41-
...jsConfig,
42-
overrides: [tsConfig, jsonConfig, yamlConfig, htmlConfig, astroConfig, ...maybeAddCoffeeScript()],
43-
settings: {
44-
...pluginImportSettings,
45-
},
46-
}
30+
const config: Linter.FlatConfig[] = [
31+
// {
32+
// ignores: ["node_modules/"],
33+
// ...jsConfig,
34+
// settings: {
35+
// ...pluginImportSettings,
36+
// },
37+
// },
38+
jsConfig,
39+
tsConfig,
40+
jsonConfig,
41+
yamlConfig,
42+
htmlConfig,
43+
astroConfig,
44+
...maybeAddCoffeeScript(),
45+
]
46+
47+
// console.log(config)
4748

4849
export default config

0 commit comments

Comments
 (0)