-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy patheslint.config.mjs
More file actions
134 lines (129 loc) · 3.94 KB
/
Copy patheslint.config.mjs
File metadata and controls
134 lines (129 loc) · 3.94 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import js from "@eslint/js"
import globals from "globals"
import tseslint from "typescript-eslint"
import wcPlugin from "eslint-plugin-wc"
import litPlugin from "eslint-plugin-lit"
import pluginVue from "eslint-plugin-vue"
import reactHooksPlugin from "eslint-plugin-react-hooks"
import stylistic from "@stylistic/eslint-plugin"
export default [
// Global ignores
{
ignores: [
"**/dist/**",
"**/build/**",
"**/node_modules/**",
"**/.vite/**",
"**/scripts/**",
"**/.docusaurus/**",
"**/.next/**",
"**/next-env.d.ts",
],
},
// Base config for all projects
js.configs.recommended,
...tseslint.configs.recommended,
// General TypeScript/JavaScript files
{
files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx,vue}"],
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
plugins: {
"@stylistic": stylistic,
},
rules: {
"func-style": ["error", "expression"],
eqeqeq: "error",
curly: "error",
"@stylistic/padding-line-between-statements": [
"error",
{ blankLine: "always", prev: "*", next: "return" },
{ blankLine: "always", prev: "if", next: "*" },
],
},
},
// Specific config for React packages (hooks correctness)
{
files: [
"packages/foresightjs-react/**/*.{ts,tsx}",
"packages/devpage-framework/**/*.{ts,tsx}",
"packages/devpage-nextjs/**/*.{ts,tsx}",
],
plugins: {
"react-hooks": reactHooksPlugin,
},
rules: {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "error",
},
},
// Specific config for js.foresight-devtools package (Web Components & Lit)
{
files: ["packages/js.foresight-devtools/**/*.{js,ts}"],
plugins: {
wc: wcPlugin,
lit: litPlugin,
},
rules: {
...wcPlugin.configs.recommended.rules,
...litPlugin.configs.recommended.rules,
},
},
// Specific config for Vue packages (Vue.js)
...pluginVue.configs["flat/essential"].map(config => ({
...config,
files: ["packages/devpage-framework/**/*.vue", "packages/foresightjs-vue/**/*.vue"],
})),
{
files: ["packages/devpage-framework/**/*.vue", "packages/foresightjs-vue/**/*.vue"],
languageOptions: {
globals: {
...globals.browser,
},
parserOptions: {
parser: tseslint.parser,
extraFileExtensions: [".vue"],
ecmaVersion: "latest",
sourceType: "module",
},
},
rules: {
"vue/multi-word-component-names": "off",
"vue/block-order": ["error", { order: ["script", "template", "style"] }],
"vue/block-lang": ["error", { script: { lang: "ts" } }],
"vue/component-api-style": ["error", ["script-setup"]],
"vue/component-name-in-template-casing": [
"error",
"PascalCase",
{ registeredComponentsOnly: true, ignores: [] },
],
"vue/custom-event-name-casing": ["error", "camelCase"],
"vue/define-emits-declaration": ["error", "type-based"],
"vue/define-props-declaration": ["error", "type-based"],
"vue/define-props-destructuring": "error",
"vue/define-macros-order": [
"error",
{
order: ["defineModel", "defineEmits", "defineSlots"],
},
],
"vue/html-button-has-type": "error",
"vue/no-empty-component-block": "error",
"vue/no-ref-object-reactivity-loss": "error",
"vue/no-required-prop-with-default": "error",
"vue/no-unused-emit-declarations": "error",
"vue/no-use-v-else-with-v-for": "error",
"vue/no-useless-v-bind": "error",
"vue/padding-line-between-blocks": ["error", "always"],
"vue/prefer-true-attribute-shorthand": "error",
"vue/prefer-use-template-ref": "error",
"vue/v-bind-style": ["error", "shorthand", { sameNameShorthand: "always" }],
"vue/v-on-style": ["error", "shorthand"],
"vue/v-slot-style": ["error", "shorthand"],
},
},
]