-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflat.mjs
146 lines (145 loc) · 3.71 KB
/
flat.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
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
135
136
137
138
139
140
141
142
143
144
145
146
import js from "@eslint/js";
import pluginImport from "eslint-plugin-import";
import pluginNoAutofix from "eslint-plugin-no-autofix";
import pluginPrettierRecommended from "eslint-plugin-prettier/recommended";
import pluginPrettierVue from "eslint-plugin-prettier-vue";
import pluginVitest from "eslint-plugin-vitest";
import pluginVue from "eslint-plugin-vue";
import globals from "globals";
export default [
// Configs and Plugins
js.configs.recommended, // Recommended config applied to all files
{
plugins: {
import: pluginImport,
"no-autofix": pluginNoAutofix,
},
},
...pluginVue.configs["flat/essential"],
pluginPrettierRecommended, // Prettier wants to always be the last plugin
// Project Overrides
{
// Global Ignore
ignores: ["**/dist/**", "dist/"],
},
{
languageOptions: {
globals: globals.node,
},
},
{
rules: {
"import/extensions": ["error", "ignorePackages"],
"import/no-unresolved": ["error", { ignore: ["^csv-stringify/sync$"] }],
"no-autofix/prefer-const": "warn",
"no-console": "warn",
"no-fallthrough": "error",
"no-shadow": "error",
"no-shadow-restricted-names": "error",
"no-unused-vars": "warn",
"no-use-before-define": [
"error",
{ functions: true, classes: true, variables: true },
],
"object-shorthand": ["error", "always"],
"no-restricted-syntax": [
"error",
{
selector: "CallExpression[callee.name='require']",
message: "Unexpected require, use import instead.",
},
{
selector:
"MemberExpression[object.name='module'][property.name='exports']",
message: "Unexpected module.exports, use export instead.",
},
{
selector: "MemberExpression[object.name='exports']",
message: "Unexpected exports, use export instead.",
},
],
},
},
{
settings: {
"import/resolver": {
node: {
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
},
},
},
// File Overrides
{
files: ["**/__tests__/**", "**/*.spec.js", "**/*.test.js"],
plugins: {
vitest: pluginVitest,
},
rules: {
"vitest/no-focused-tests": ["error", { fixable: false }],
"vitest/no-disabled-tests": "warn",
},
},
{
files: ["**/*.cjs"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "script",
},
rules: {
"no-restricted-syntax": [
"error",
{
selector: "ImportDeclaration",
message: "Unexpected import, use require instead.",
},
{
selector: "ExportNamedDeclaration",
message: "Unexpected export, use module.exports instead.",
},
{
selector: "ExportDefaultDeclaration",
message: "Unexpected export, use module.exports instead.",
},
],
},
},
{
files: ["**/*.vue"],
plugins: {
"prettier-vue": pluginPrettierVue,
},
rules: {
"import/extensions": "off",
"prettier/prettier": "off",
"prettier-vue/prettier": "error",
},
},
{
files: [
"packages/*-vue/**/*.js",
"packages/*-vue/**/*.mjs",
"packages/*-vue/**/*.vue",
"packages/vue/**/*.js",
"packages/vue/**/*.mjs",
"packages/vue/**/*.vue",
"packages/vue-*/**/*.js",
"packages/vue-*/**/*.mjs",
"packages/vue-*/**/*.vue",
"vue/**/*.js",
"vue/**/*.mjs",
"vue/**/*.vue",
],
rules: {
"import/extensions": "off",
},
settings: {
"import/resolver": {
alias: {
extensions: [".js", ".vue"],
map: [["@", "./vue/src"]],
},
},
},
},
];