-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
43 lines (41 loc) · 1.32 KB
/
eslint.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* eslint-disable no-underscore-dangle */
import pluginJs from "@eslint/js";
import prettierConfig from "eslint-config-prettier";
import prettierPluginRecommended from "eslint-plugin-prettier/recommended";
import tseslint from "typescript-eslint";
/** @see https://www.raulmelo.me/en/blog/migration-eslint-to-flat-config */
import { FlatCompat } from "@eslint/eslintrc";
import path from "path";
import { fileURLToPath } from "url";
// mimic CommonJS variables -- not needed if using CommonJS
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname, // optional; default: process.cwd()
resolvePluginsRelativeTo: __dirname, // optional
});
/** @type {import('eslint').Linter.Config[]} */
export default [
{ files: ["**/*.{js,mjs,cjs,ts}"] },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
...compat.extends("airbnb-base"),
prettierConfig,
prettierPluginRecommended,
{
rules: {
"import/no-extraneous-dependencies": [
"warn",
{
devDependencies: [
"**/*.config.{mts,ts,mjs,js}",
"**/storybook/**",
"**/stories/**",
"**/*.stories.{ts,tsx,js,jsx}",
"**/*.{spec,test}.{ts,tsx,js,jsx}",
],
},
],
},
},
];