-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
58 lines (56 loc) · 1.43 KB
/
Copy patheslint.config.js
File metadata and controls
58 lines (56 loc) · 1.43 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import js from "@eslint/js";
import { defineConfig } from "eslint/config";
import importPlugin from "eslint-plugin-import";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import solid from "eslint-plugin-solid/configs/recommended";
import globals from "globals";
import tseslint from "typescript-eslint";
export default defineConfig([
{
files: ["**/*.{js,jsx}"],
plugins: { js },
extends: ["js/recommended"],
languageOptions: {
globals: globals.browser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
},
banImportsFromSiblings("popup"),
banImportsFromSiblings("background"),
banImportsFromSiblings("offscreen"),
tseslint.configs.recommended,
solid,
{
plugins: {
"simple-import-sort": simpleImportSort,
import: importPlugin,
},
rules: {
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error",
},
},
]);
function banImportsFromSiblings(topFolder) {
const topFolders = ["popup", "background", "offscreen"];
return {
files: [`src/${topFolder}/**/*.{ts,tsx}`],
rules: {
"no-restricted-imports": [
"error",
{
patterns: topFolders
.filter((f) => f !== topFolder)
.map((f) => `@/${f}/*`),
},
],
},
};
}