effect-app 3.3.2 → 3.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/eslint.config.mjs +3 -2
- package/package.json +1 -1
- package/src/eslint.base.config.mjs +212 -0
- package/src/eslint.vue.config.mjs +111 -0
package/CHANGELOG.md
CHANGED
package/eslint.config.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path"
|
|
2
2
|
import { fileURLToPath } from "node:url"
|
|
3
|
-
import { augmentedConfig } from "
|
|
3
|
+
import { augmentedConfig } from "./src/eslint.base.config.mjs"
|
|
4
4
|
|
|
5
5
|
const __filename = fileURLToPath(import.meta.url)
|
|
6
6
|
const __dirname = path.dirname(__filename)
|
|
@@ -12,7 +12,8 @@ export default [
|
|
|
12
12
|
"**/*.js",
|
|
13
13
|
"**/*.jsx",
|
|
14
14
|
"**/*.d.ts",
|
|
15
|
-
"node_modules/"
|
|
15
|
+
"node_modules/",
|
|
16
|
+
"src/eslint.*.config.mjs"
|
|
16
17
|
]
|
|
17
18
|
},
|
|
18
19
|
{
|
package/package.json
CHANGED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { FlatCompat } from "@eslint/eslintrc"
|
|
4
|
+
import js from "@eslint/js"
|
|
5
|
+
import path from "node:path"
|
|
6
|
+
import { fileURLToPath } from "node:url"
|
|
7
|
+
|
|
8
|
+
import tsParser from "@typescript-eslint/parser"
|
|
9
|
+
|
|
10
|
+
import codegen from "eslint-plugin-codegen"
|
|
11
|
+
import _import from "eslint-plugin-import"
|
|
12
|
+
import sortDestructureKeys from "eslint-plugin-sort-destructure-keys"
|
|
13
|
+
import unusedImports from "eslint-plugin-unused-imports"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
import eslint from '@eslint/js';
|
|
17
|
+
import tseslint from 'typescript-eslint';
|
|
18
|
+
import dprint from "@ben_12/eslint-plugin-dprint";
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
22
|
+
const __dirname = path.dirname(__filename)
|
|
23
|
+
|
|
24
|
+
const compat = new FlatCompat({
|
|
25
|
+
baseDirectory: __dirname,
|
|
26
|
+
recommendedConfig: js.configs.recommended,
|
|
27
|
+
allConfig: js.configs.all
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @param {string} dirName
|
|
32
|
+
* @param {boolean} [forceTS=false]
|
|
33
|
+
* @returns {import("eslint").Linter.FlatConfig[]}
|
|
34
|
+
*/
|
|
35
|
+
export function baseConfig(dirName, forceTS = false, project = undefined) {
|
|
36
|
+
// eslint-disable-next-line no-undef
|
|
37
|
+
const enableTS = !!dirName && (forceTS || process.env["ESLINT_TS"])
|
|
38
|
+
return [
|
|
39
|
+
{
|
|
40
|
+
ignores: [
|
|
41
|
+
"**/*.js",
|
|
42
|
+
// "**/*.mjs",
|
|
43
|
+
// "**/*.cjs",
|
|
44
|
+
"**/*.jsx",
|
|
45
|
+
"**/*.d.ts",
|
|
46
|
+
"**/node_modules/**",
|
|
47
|
+
"vitest.config.ts",
|
|
48
|
+
"vitest.config.test.ts",
|
|
49
|
+
"vite.config.ts",
|
|
50
|
+
"eslint.*.mjs",
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
js.configs.recommended,
|
|
54
|
+
...tseslint.config(
|
|
55
|
+
eslint.configs.recommended,
|
|
56
|
+
tseslint.configs.recommended,
|
|
57
|
+
),
|
|
58
|
+
...(enableTS ? tseslint.configs.recommendedTypeChecked : []),
|
|
59
|
+
{
|
|
60
|
+
// otherwise this config object doesn't apply inside vue files
|
|
61
|
+
// I mean the rules are not applied, the plugins are not loaded
|
|
62
|
+
// files: ["**/*.ts", "**/*.tsx"],
|
|
63
|
+
name: "base",
|
|
64
|
+
languageOptions: {
|
|
65
|
+
parser: tsParser,
|
|
66
|
+
parserOptions: {
|
|
67
|
+
extraFileExtensions: [".vue"], // should be the same as vue config for perfomance reasons (https://typescript-eslint.io/troubleshooting/typed-linting/performance#project-service-issues)
|
|
68
|
+
...(enableTS
|
|
69
|
+
&& {
|
|
70
|
+
tsconfigRootDir: dirName,
|
|
71
|
+
projectService: true
|
|
72
|
+
})
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
settings: {
|
|
76
|
+
"import/parsers": {
|
|
77
|
+
"@typescript-eslint/parser": [".ts", ".tsx"]
|
|
78
|
+
},
|
|
79
|
+
"import/resolver": {
|
|
80
|
+
typescript: {
|
|
81
|
+
alwaysTryTypes: true
|
|
82
|
+
} // this loads <rootdir>/tsconfig.json to eslint
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
linterOptions: {
|
|
86
|
+
reportUnusedDisableDirectives: "off"
|
|
87
|
+
},
|
|
88
|
+
plugins: {
|
|
89
|
+
import: _import,
|
|
90
|
+
"sort-destructure-keys": sortDestructureKeys,
|
|
91
|
+
"unused-imports": unusedImports,
|
|
92
|
+
codegen
|
|
93
|
+
},
|
|
94
|
+
rules: {
|
|
95
|
+
"no-unexpected-multiline": "off",
|
|
96
|
+
"no-restricted-imports": ["error", {
|
|
97
|
+
"paths": [
|
|
98
|
+
{
|
|
99
|
+
name: ".",
|
|
100
|
+
"message":
|
|
101
|
+
"Please import from the specific file instead. Imports from index in the same directory are almost always wrong (circular)."
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: "./",
|
|
105
|
+
"message":
|
|
106
|
+
"Please import from the specific file instead. Imports from index in the same directory are almost always wrong (circular)."
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: "./index",
|
|
110
|
+
"message":
|
|
111
|
+
"Please import from the specific file instead. Imports from index in the same directory are almost always wrong (circular)."
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
}],
|
|
115
|
+
"@typescript-eslint/no-namespace": "off", // We like namespaces, where ES modules cannot compete (augmenting existing types)
|
|
116
|
+
"no-unused-vars": "off",
|
|
117
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
118
|
+
"unused-imports/no-unused-imports": "error",
|
|
119
|
+
"unused-imports/no-unused-vars": [
|
|
120
|
+
"warn",
|
|
121
|
+
{
|
|
122
|
+
"vars": "all",
|
|
123
|
+
"varsIgnorePattern": "^_",
|
|
124
|
+
"args": "after-used",
|
|
125
|
+
"argsIgnorePattern": "^_",
|
|
126
|
+
"ignoreRestSiblings": true
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
"@typescript-eslint/no-use-before-define": ["warn", { functions: false, classes: true, variables: true }], // functions may depend on classes or variables defined later
|
|
130
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
131
|
+
"@typescript-eslint/interface-name-prefix": "off",
|
|
132
|
+
"@typescript-eslint/no-empty-object-type": "off",
|
|
133
|
+
"sort-destructure-keys/sort-destructure-keys": "error", // Mainly to sort render props
|
|
134
|
+
"require-yield": "off", // we want to be able to use e.g Effect.gen without having to worry about lint.
|
|
135
|
+
"sort-imports": "off",
|
|
136
|
+
"import/first": "error",
|
|
137
|
+
"import/newline-after-import": "error",
|
|
138
|
+
"import/no-duplicates": ["error", {"prefer-inline": true}],
|
|
139
|
+
"import/no-unresolved": "off", // eslint don't understand some imports very well
|
|
140
|
+
"import/order": "off",
|
|
141
|
+
"@typescript-eslint/consistent-type-imports": ["error", { fixStyle: 'inline-type-imports' }],
|
|
142
|
+
|
|
143
|
+
"object-shorthand": "error",
|
|
144
|
+
...(enableTS
|
|
145
|
+
&& {
|
|
146
|
+
"@typescript-eslint/restrict-template-expressions": "warn",
|
|
147
|
+
"@typescript-eslint/restrict-plus-operands": "off",
|
|
148
|
+
"@typescript-eslint/no-unsafe-assignment": "warn",
|
|
149
|
+
"@typescript-eslint/no-unsafe-call": "warn",
|
|
150
|
+
"@typescript-eslint/no-unsafe-return": "warn",
|
|
151
|
+
"@typescript-eslint/no-unsafe-argument": "warn",
|
|
152
|
+
"@typescript-eslint/no-unsafe-member-access": "warn",
|
|
153
|
+
"@typescript-eslint/no-misused-promises": "warn",
|
|
154
|
+
"@typescript-eslint/unbound-method": "warn",
|
|
155
|
+
"@typescript-eslint/only-throw-error": "off",
|
|
156
|
+
"@typescript-eslint/no-base-to-string": "warn",
|
|
157
|
+
"@typescript-eslint/no-floating-promises": "warn",
|
|
158
|
+
})
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @param {string} dirName
|
|
166
|
+
* @param {boolean} [forceTS=false]
|
|
167
|
+
* @returns {import("eslint").Linter.FlatConfig[]}
|
|
168
|
+
*/
|
|
169
|
+
export function augmentedConfig(dirName, forceTS = false, project = undefined) {
|
|
170
|
+
return [
|
|
171
|
+
...baseConfig(dirName, forceTS, project),
|
|
172
|
+
{
|
|
173
|
+
name: "augmented",
|
|
174
|
+
plugins: {
|
|
175
|
+
"@ben_12/dprint": dprint
|
|
176
|
+
},
|
|
177
|
+
rules: {
|
|
178
|
+
...dprint.configs["typescript-recommended"].rules,
|
|
179
|
+
"@ben_12/dprint/typescript": [
|
|
180
|
+
"error",
|
|
181
|
+
{
|
|
182
|
+
// Use dprint JSON configuration file (default: "dprint.json")
|
|
183
|
+
// It may be created using `dprint init` command
|
|
184
|
+
// See also https://dprint.dev/config/
|
|
185
|
+
//configFile: "dprint.json",
|
|
186
|
+
// The TypeScript configuration of dprint
|
|
187
|
+
// See also https://dprint.dev/plugins/typescript/config/
|
|
188
|
+
config: {
|
|
189
|
+
// The TypeScript configuration of dprint
|
|
190
|
+
// See also https://dprint.dev/plugins/typescript/config/,
|
|
191
|
+
"indentWidth": 2,
|
|
192
|
+
"semiColons": "asi",
|
|
193
|
+
"quoteStyle": "alwaysDouble",
|
|
194
|
+
"trailingCommas": "never",
|
|
195
|
+
"arrowFunction.useParentheses": "force",
|
|
196
|
+
"memberExpression.linePerExpression": true,
|
|
197
|
+
"binaryExpression.linePerExpression": true,
|
|
198
|
+
"importDeclaration.forceSingleLine": true,
|
|
199
|
+
"exportDeclaration.forceSingleLine": true
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
"codegen/codegen": [
|
|
204
|
+
"error",
|
|
205
|
+
{
|
|
206
|
+
presets: "@effect-app/eslint-codegen-model/dist/presets/index.js"
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import formatjs from "eslint-plugin-formatjs"
|
|
2
|
+
import pluginVue from "eslint-plugin-vue"
|
|
3
|
+
import { defineConfigWithVueTs, vueTsConfigs } from "@vue/eslint-config-typescript"
|
|
4
|
+
|
|
5
|
+
import tseslint from "typescript-eslint"
|
|
6
|
+
|
|
7
|
+
import { baseConfig } from "./eslint.base.config.mjs"
|
|
8
|
+
|
|
9
|
+
import dprint from "@ben_12/eslint-plugin-dprint"
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @param {string} dirName
|
|
13
|
+
* @param {boolean} [forceTS=false]
|
|
14
|
+
* @returns {import("eslint").Linter.FlatConfig[]}
|
|
15
|
+
*/
|
|
16
|
+
export function vueConfig(dirName, forceTS = false, dprintConfigFile = "dprint.json") {
|
|
17
|
+
const enableTS = !!dirName && (forceTS || process.env["ESLINT_TS"])
|
|
18
|
+
|
|
19
|
+
return [
|
|
20
|
+
...baseConfig(dirName, forceTS),
|
|
21
|
+
|
|
22
|
+
// ...ts.configs.recommended,
|
|
23
|
+
// this should set the vue parser as the parser plus some recommended rules
|
|
24
|
+
...pluginVue.configs["flat/recommended"],
|
|
25
|
+
...defineConfigWithVueTs(vueTsConfigs.base),
|
|
26
|
+
{
|
|
27
|
+
name: "vue",
|
|
28
|
+
files: ["*.vue", "**/*.vue"],
|
|
29
|
+
languageOptions: {
|
|
30
|
+
parserOptions: {
|
|
31
|
+
// set a custom parser to parse <script> tags
|
|
32
|
+
parser: {
|
|
33
|
+
"<template>": tseslint.parser,
|
|
34
|
+
"ts": tseslint.parser,
|
|
35
|
+
"js": tseslint.parser,
|
|
36
|
+
},
|
|
37
|
+
...(enableTS && {
|
|
38
|
+
projectService: true,
|
|
39
|
+
tsconfigRootDir: dirName,
|
|
40
|
+
}),
|
|
41
|
+
extraFileExtensions: [".vue"]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
rules: {
|
|
45
|
+
"no-undef": "off",
|
|
46
|
+
"vue/multi-word-component-names": "warn",
|
|
47
|
+
"vue/no-template-shadow": "warn",
|
|
48
|
+
"vue/valid-v-slot": [
|
|
49
|
+
"error",
|
|
50
|
+
{
|
|
51
|
+
allowModifiers: true,
|
|
52
|
+
},
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
plugins: {
|
|
56
|
+
formatjs, // this is for ICU messages, so I'd say we need it here
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
{
|
|
61
|
+
name: "augmented",
|
|
62
|
+
plugins: {
|
|
63
|
+
"@ben_12/dprint": dprint,
|
|
64
|
+
},
|
|
65
|
+
rules: {
|
|
66
|
+
...dprint.configs["disable-typescript-conflict-rules"].rules,
|
|
67
|
+
"vue/html-indent": "off",
|
|
68
|
+
...dprint.configs["typescript-recommended"].rules,
|
|
69
|
+
...dprint.configs["malva-recommended"].rules,
|
|
70
|
+
...dprint.configs["markup-recommended"].rules,
|
|
71
|
+
"@ben_12/dprint/markup": [
|
|
72
|
+
"error",
|
|
73
|
+
{
|
|
74
|
+
// Use dprint JSON configuration file (default: "dprint.json")
|
|
75
|
+
// It may be created using `dprint init` command
|
|
76
|
+
// See also https://dprint.dev/config/
|
|
77
|
+
configFile: dprintConfigFile,
|
|
78
|
+
config: {
|
|
79
|
+
// The markup_fmt configuration of dprint
|
|
80
|
+
// See also https://dprint.dev/plugins/markup_fmt/config/
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
"@ben_12/dprint/typescript": [
|
|
85
|
+
"error",
|
|
86
|
+
{
|
|
87
|
+
// Use dprint JSON configuration file (default: "dprint.json")
|
|
88
|
+
// It may be created using `dprint init` command
|
|
89
|
+
// See also https://dprint.dev/config/
|
|
90
|
+
configFile: "dprint.json",
|
|
91
|
+
// The TypeScript configuration of dprint
|
|
92
|
+
// See also https://dprint.dev/plugins/typescript/config/
|
|
93
|
+
config: {
|
|
94
|
+
// The TypeScript configuration of dprint
|
|
95
|
+
// See also https://dprint.dev/plugins/typescript/config/,
|
|
96
|
+
indentWidth: 2,
|
|
97
|
+
semiColons: "asi",
|
|
98
|
+
quoteStyle: "alwaysDouble",
|
|
99
|
+
trailingCommas: "never",
|
|
100
|
+
"arrowFunction.useParentheses": "force",
|
|
101
|
+
"memberExpression.linePerExpression": true,
|
|
102
|
+
"binaryExpression.linePerExpression": true,
|
|
103
|
+
"importDeclaration.forceSingleLine": true,
|
|
104
|
+
"exportDeclaration.forceSingleLine": true,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
]
|
|
111
|
+
}
|