forked from metabase/metabase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.module-boundaries.mjs
More file actions
115 lines (108 loc) · 3.28 KB
/
eslint.config.module-boundaries.mjs
File metadata and controls
115 lines (108 loc) · 3.28 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// Standalone eslint config for running only module boundary linting.
//
// Usage: bunx eslint --config eslint.config.module-boundaries.mjs "frontend/src/**/*.{js,jsx,ts,tsx}" "enterprise/frontend/src/**/*.{js,jsx,ts,tsx}"
import path from "path";
import { fileURLToPath } from "url";
import boundaries from "eslint-plugin-boundaries";
import react from "eslint-plugin-react";
import tseslint from "typescript-eslint";
import { globalIgnores, defineConfig } from "eslint/config";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
import { elements as boundaryElements, rules as boundaryRules } from "./frontend/lint/module-boundaries.mjs";
// dummy plugins to keep eslint from complaining about missing plugins and settings
const alwaysPassingRule = {
meta: {
type: "problem",
docs: {
description: "stub for ttag/no-module-declaration - always passes",
},
schema: [],
},
create() {
// Return an empty visitor object - this rule does nothing and always passes
return {};
},
};
const alwaysPassingPlugin = {
rules: {
"no-module-declaration": alwaysPassingRule,
"no-default-export": alwaysPassingRule,
"no-color-literals": alwaysPassingRule,
order: alwaysPassingRule,
"rules-of-hooks": alwaysPassingRule,
"no-unconditional-metabase-links-render": alwaysPassingRule,
"no-literal-string": alwaysPassingRule,
"no-literal-metabase-strings": alwaysPassingRule,
"no-require-imports": alwaysPassingRule,
"no-external-references-for-sdk-package-code": alwaysPassingRule,
"exhaustive-deps": alwaysPassingRule,
"no-unused-vars": alwaysPassingRule,
"no-unused-expressions": alwaysPassingRule,
"ban-ts-comment": alwaysPassingRule,
"no-empty-object-type": alwaysPassingRule,
"no-commonjs": alwaysPassingRule,
"consistent-type-imports": alwaysPassingRule,
},
};
export default defineConfig([
globalIgnores(["**/*.unit.spec.*", "**/e2e/**", "*.stories.*", "test/**"]),
{
linterOptions: {
reportUnusedDisableDirectives: "off",
},
files: [
"frontend/src/**/*.{js,jsx,ts,tsx}",
"enterprise/frontend/src/**/*.{js,jsx,ts,tsx}",
],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
plugins: {
ttag: alwaysPassingPlugin,
metabase: alwaysPassingPlugin,
import: alwaysPassingPlugin,
i18next: alwaysPassingPlugin,
"react-hooks": alwaysPassingPlugin,
"@typescript-eslint": alwaysPassingPlugin,
boundaries,
react,
},
settings: {
"boundaries/elements": boundaryElements,
"boundaries/ignore": [
"**/*.unit.spec.*",
"**/e2e/**",
"*.stories.*",
"test/**",
],
"import-x/resolver": {
node: true,
webpack: {
config: path.resolve(__dirname, "./rspack.main.config.js"),
typescript: true,
},
},
"import/resolver": {
node: true,
webpack: {
config: path.resolve(__dirname, "./rspack.main.config.js"),
typescript: true,
},
},
},
rules: {
"boundaries/element-types": [
"error",
{
default: "disallow",
rules: boundaryRules,
},
],
},
},
]);