Skip to content

Commit

Permalink
chore: migrate to eslint flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
susisu committed Dec 11, 2023
1 parent f623b61 commit a58de95
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 41 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

40 changes: 0 additions & 40 deletions .eslintrc.js

This file was deleted.

53 changes: 53 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
"use strict";

const { config, map } = require("@susisu/eslint-config");
const prettierConfig = require("eslint-config-prettier");
const vitestPlugin = require("eslint-plugin-vitest");
const globals = require("globals");

module.exports = [
...map({ files: ["src/**/*.ts"] }, [
config.tsTypeChecked(),
{
languageOptions: {
sourceType: "module",
parserOptions: {
project: "./tsconfig.json",
},
globals: {
...globals.es2021,
...globals.node,
},
},
},
]),
...map({ files: ["src/**/*.spec.ts", "src/**/__tests__/**/*.ts"] }, [
{
plugins: {
vitest: vitestPlugin,
},
languageOptions: {
globals: {
...vitestPlugin.environments.env.globals,
},
},
rules: {
...vitestPlugin.configs.recommended.rules,
"vitest/expect-expect": ["error", { customExpressions: ["expect", "assertType"] }],
},
},
]),
...map({ files: ["*.js"] }, [
config.js(),
{
languageOptions: {
sourceType: "commonjs",
globals: {
...globals.es2021,
...globals.node,
},
},
},
]),
prettierConfig,
];
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"eslint": "^8.55.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-vitest": "^0.3.15",
"globals": "^13.24.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.1.1",
"rimraf": "^5.0.5",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a58de95

Please sign in to comment.