Skip to content

Commit 8c29011

Browse files
authored
Update ESLint (#5)
* Update ESLint * Convert eslint to flat config
1 parent c592ec4 commit 8c29011

File tree

6 files changed

+44
-33
lines changed

6 files changed

+44
-33
lines changed

.eslintrc.js

-24
This file was deleted.

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"eslint.experimental.useFlatConfig": true
3+
}

eslint.config.mjs

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import noOnlyPlugin from "eslint-plugin-no-only-tests";
2+
import eslint from "@eslint/js";
3+
4+
export default [
5+
eslint.configs.recommended,
6+
{
7+
rules: {
8+
semi: "error",
9+
"prefer-const": "error",
10+
},
11+
},
12+
{
13+
files: ["**/*.js"],
14+
languageOptions: {
15+
globals: {
16+
require: "readonly",
17+
module: "readonly",
18+
},
19+
},
20+
},
21+
// Prevent .only in tests
22+
{
23+
plugins: {
24+
"no-only-tests": noOnlyPlugin,
25+
},
26+
rules: { "no-only-tests/no-only-tests": "error" },
27+
},
28+
];

index.test.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function format(css) {
1212
}
1313

1414
async function run(input, output, opts, postcssOpts = {}) {
15-
let result = await postcss([plugin(opts)]).process(input, postcssOpts);
15+
const result = await postcss([plugin(opts)]).process(input, postcssOpts);
1616
expect(format(result.css)).toEqual(format(output));
1717
expect(result.warnings()).toHaveLength(0);
1818
}

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@
2929
"postcss": "^8.3.0"
3030
},
3131
"devDependencies": {
32+
"@eslint/js": "^8.57.0",
3233
"c8": "^7.11.3",
3334
"clean-publish": "^3.4.2",
34-
"eslint": "^8.0.1",
35-
"eslint-plugin-no-only-tests": "^2.6.0",
35+
"eslint": "^8.57.0",
36+
"eslint-plugin-no-only-tests": "^3.1.0",
3637
"postcss": "^8.3.11",
3738
"prettier": "^2.6.2",
3839
"vite": "^2.9.9",

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)