@zthun/janitor-eslint-config 19.1.0 → 19.1.1
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/dist/index.cjs +125 -179
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +132 -176
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,202 +1,148 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
value: value,
|
|
16
|
-
enumerable: true,
|
|
17
|
-
configurable: true,
|
|
18
|
-
writable: true
|
|
19
|
-
});
|
|
20
|
-
} else {
|
|
21
|
-
obj[key] = value;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const globals = require("globals");
|
|
4
|
+
const _import = require("eslint-plugin-import");
|
|
5
|
+
const js = require("@eslint/js");
|
|
6
|
+
const pretty = require("eslint-plugin-prettier/recommended");
|
|
7
|
+
const _react = require("eslint-plugin-react");
|
|
8
|
+
const ts = require("typescript-eslint");
|
|
9
|
+
function environment(environment2) {
|
|
10
|
+
return {
|
|
11
|
+
languageOptions: {
|
|
12
|
+
globals: {
|
|
13
|
+
...environment2
|
|
14
|
+
}
|
|
22
15
|
}
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
function _object_spread(target) {
|
|
26
|
-
for(var i = 1; i < arguments.length; i++){
|
|
27
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
28
|
-
var ownKeys = Object.keys(source);
|
|
29
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
30
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
31
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
32
|
-
}));
|
|
33
|
-
}
|
|
34
|
-
ownKeys.forEach(function(key) {
|
|
35
|
-
_define_property(target, key, source[key]);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
return target;
|
|
39
|
-
}
|
|
40
|
-
function environment(environment) {
|
|
41
|
-
return {
|
|
42
|
-
languageOptions: {
|
|
43
|
-
globals: _object_spread({}, environment)
|
|
44
|
-
}
|
|
45
|
-
};
|
|
16
|
+
};
|
|
46
17
|
}
|
|
47
18
|
const environments = {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
],
|
|
51
|
-
node: [
|
|
52
|
-
environment(globals.node),
|
|
53
|
-
environment(globals.nodeBuiltin)
|
|
54
|
-
]
|
|
19
|
+
browser: [environment(globals.browser)],
|
|
20
|
+
node: [environment(globals.node), environment(globals.nodeBuiltin)]
|
|
55
21
|
};
|
|
56
|
-
|
|
57
22
|
const imports = [
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
23
|
+
_import.flatConfigs.recommended,
|
|
24
|
+
{
|
|
25
|
+
rules: {
|
|
26
|
+
// This lint error is the main reason to use import as we want to make
|
|
27
|
+
// sure we've installed our dependencies correctly.
|
|
28
|
+
"import/no-extraneous-dependencies": "error",
|
|
29
|
+
// These are straight up broken with Typescript when you need to work with
|
|
30
|
+
// mts files that must have the file extension present. These can be fixed
|
|
31
|
+
// using resolves, but it's such a pain and it's just not worth the hassle
|
|
32
|
+
// for basic linting support. The no-extraneous-dependencies is really
|
|
33
|
+
// the recommended config we want, so these being forced off are fine.
|
|
34
|
+
"import/named": "off",
|
|
35
|
+
"import/no-unresolved": "off"
|
|
72
36
|
}
|
|
37
|
+
}
|
|
73
38
|
];
|
|
74
|
-
|
|
75
39
|
const javascript = [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
// access arguments. Those constructors are often empty - so we want to let
|
|
87
|
-
// a part of this one through.
|
|
88
|
-
"no-empty-function": "off"
|
|
89
|
-
}
|
|
40
|
+
js.configs.recommended,
|
|
41
|
+
{
|
|
42
|
+
rules: {
|
|
43
|
+
// We want to support == null so we get a good check for undefined
|
|
44
|
+
// or null
|
|
45
|
+
eqeqeq: ["error", "smart"],
|
|
46
|
+
// Would be fine, but there's a bug in this where you have a function with
|
|
47
|
+
// access arguments. Those constructors are often empty - so we want to let
|
|
48
|
+
// a part of this one through.
|
|
49
|
+
"no-empty-function": "off"
|
|
90
50
|
}
|
|
51
|
+
}
|
|
91
52
|
];
|
|
92
|
-
|
|
93
|
-
const prettier = [
|
|
94
|
-
pretty
|
|
95
|
-
];
|
|
96
|
-
|
|
53
|
+
const prettier = [pretty];
|
|
97
54
|
const react = [
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
ecmaFeatures: {
|
|
108
|
-
jsx: true
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
settings: {
|
|
113
|
-
react: {
|
|
114
|
-
version: "detect"
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
rules: {
|
|
118
|
-
// This one is not needed any longer as TypeScript jsx option
|
|
119
|
-
// should be set to react-jsx. You will need to turn this on
|
|
120
|
-
// manually if it is set to the legacy react setting. See
|
|
121
|
-
// https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#whats-different-in-the-new-transform
|
|
122
|
-
"react/react-in-jsx-scope": "off"
|
|
55
|
+
{
|
|
56
|
+
files: ["**/*.{js,cjs,mjs,ts,mts,jsx,tsx}"],
|
|
57
|
+
plugins: {
|
|
58
|
+
react: _react
|
|
59
|
+
},
|
|
60
|
+
languageOptions: {
|
|
61
|
+
parserOptions: {
|
|
62
|
+
ecmaFeatures: {
|
|
63
|
+
jsx: true
|
|
123
64
|
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
settings: {
|
|
68
|
+
react: {
|
|
69
|
+
version: "detect"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
rules: {
|
|
73
|
+
// This one is not needed any longer as TypeScript jsx option
|
|
74
|
+
// should be set to react-jsx. You will need to turn this on
|
|
75
|
+
// manually if it is set to the legacy react setting. See
|
|
76
|
+
// https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#whats-different-in-the-new-transform
|
|
77
|
+
"react/react-in-jsx-scope": "off"
|
|
124
78
|
}
|
|
79
|
+
}
|
|
125
80
|
];
|
|
126
|
-
|
|
127
81
|
const typescript = [
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
// for the bug.
|
|
182
|
-
"no-unused-expressions": "off",
|
|
183
|
-
"@typescript-eslint/no-unused-expressions": [
|
|
184
|
-
"error",
|
|
185
|
-
{
|
|
186
|
-
allowShortCircuit: false
|
|
187
|
-
}
|
|
188
|
-
]
|
|
82
|
+
...ts.configs.recommended,
|
|
83
|
+
{
|
|
84
|
+
rules: {
|
|
85
|
+
// We want to be able to use a single build system for most things.
|
|
86
|
+
// Ideally, we can use vite to build all project types so we don't
|
|
87
|
+
// have 4 different build systems across different projects. Thus
|
|
88
|
+
// we need to make sure that swc, esbuild, and tsc are supported.
|
|
89
|
+
// Forcing type imports ensures this.
|
|
90
|
+
"@typescript-eslint/consistent-type-imports": [
|
|
91
|
+
"error",
|
|
92
|
+
{ prefer: "type-imports" }
|
|
93
|
+
],
|
|
94
|
+
// There are times when any and legacy namespaces makes sense.
|
|
95
|
+
// If you use any kind of decorator library, you will almost
|
|
96
|
+
// be required to use any at some point. Forcing a non use of them
|
|
97
|
+
// means you're spending a bunch of time play type gymnastics and to
|
|
98
|
+
// hell with that.
|
|
99
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
100
|
+
"@typescript-eslint/no-namespace": "off",
|
|
101
|
+
// Would be fine, but there's a bug in this where you have a function with
|
|
102
|
+
// access arguments. Those constructors are often empty - so we want to let
|
|
103
|
+
// a part of this one through.
|
|
104
|
+
"no-empty-function": "off",
|
|
105
|
+
"@typescript-eslint/no-empty-function": [
|
|
106
|
+
"error",
|
|
107
|
+
{ allow: ["constructors"] }
|
|
108
|
+
],
|
|
109
|
+
// A lot of 3rd party libraries still don't support esm
|
|
110
|
+
// and trying to force this right now just isn't feasible.
|
|
111
|
+
"@typescript-eslint/no-var-requires": "off",
|
|
112
|
+
"@typescript-eslint/no-require-imports": "off",
|
|
113
|
+
// I want aliasing support.
|
|
114
|
+
"@typescript-eslint/no-empty-object-type": "off",
|
|
115
|
+
"@typescript-eslint/no-empty-interface": "off",
|
|
116
|
+
// You will need unsafe declaration merging if you are doing anything
|
|
117
|
+
// with decorators as what often happens is that TypeScript cannot infer
|
|
118
|
+
// the output type of a decorator. So this has to be on to deal with
|
|
119
|
+
// TypeScripts shortcoming in this department. See
|
|
120
|
+
// https://github.com/microsoft/TypeScript/issues/4881 for more information.
|
|
121
|
+
"@typescript-eslint/no-unsafe-declaration-merging": "off",
|
|
122
|
+
// I can technically agree with this, but where this comes in
|
|
123
|
+
// handy is unit testing and I value that, so I want support
|
|
124
|
+
// to make the assumption that I know what I'm doing when
|
|
125
|
+
// I make a non-null assertion.
|
|
126
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
127
|
+
// This is actually fine, but this is broken in typescript eslint 8.14.x.
|
|
128
|
+
// See https://github.com/typescript-eslint/typescript-eslint/issues/10353
|
|
129
|
+
// for the bug.
|
|
130
|
+
"no-unused-expressions": "off",
|
|
131
|
+
"@typescript-eslint/no-unused-expressions": [
|
|
132
|
+
"error",
|
|
133
|
+
{
|
|
134
|
+
allowShortCircuit: false
|
|
189
135
|
}
|
|
136
|
+
]
|
|
190
137
|
}
|
|
138
|
+
}
|
|
191
139
|
];
|
|
192
|
-
|
|
193
140
|
const recommended = [
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
141
|
+
...javascript,
|
|
142
|
+
...typescript,
|
|
143
|
+
...imports,
|
|
144
|
+
...prettier
|
|
198
145
|
];
|
|
199
|
-
|
|
200
146
|
exports.environments = environments;
|
|
201
147
|
exports.imports = imports;
|
|
202
148
|
exports.javascript = javascript;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/configs/environments.mts","../src/configs/imports.mts","../src/configs/javascript.mts","../src/configs/prettier.mts","../src/configs/react.mts","../src/configs/typescript.mts","../src/configs/recommended.mts"],"sourcesContent":["import type { Linter } from \"eslint\";\nimport globals from \"globals\";\n\nfunction environment(environment: object): Linter.Config {\n return {\n languageOptions: {\n globals: {\n ...environment,\n },\n },\n };\n}\n\nexport const environments = {\n browser: [environment(globals.browser)],\n node: [environment(globals.node), environment(globals.nodeBuiltin)],\n};\n","import type { Linter } from \"eslint\";\nimport _import from \"eslint-plugin-import\";\n\nexport const imports: Linter.Config[] = [\n _import.flatConfigs.recommended,\n {\n rules: {\n // This lint error is the main reason to use import as we want to make\n // sure we've installed our dependencies correctly.\n \"import/no-extraneous-dependencies\": \"error\",\n\n // These are straight up broken with Typescript when you need to work with\n // mts files that must have the file extension present. These can be fixed\n // using resolves, but it's such a pain and it's just not worth the hassle\n // for basic linting support. The no-extraneous-dependencies is really\n // the recommended config we want, so these being forced off are fine.\n \"import/named\": \"off\",\n \"import/no-unresolved\": \"off\",\n },\n } satisfies Linter.Config,\n];\n","import js from \"@eslint/js\";\nimport type { Linter } from \"eslint\";\n\nexport const javascript: Linter.Config[] = [\n js.configs.recommended,\n {\n rules: {\n // We want to support == null so we get a good check for undefined\n // or null\n eqeqeq: [\"error\", \"smart\"],\n // Would be fine, but there's a bug in this where you have a function with\n // access arguments. Those constructors are often empty - so we want to let\n // a part of this one through.\n \"no-empty-function\": \"off\",\n },\n },\n];\n","import pretty from \"eslint-plugin-prettier/recommended\";\n\nexport const prettier = [pretty];\n","import type { ESLint, Linter } from \"eslint\";\nimport _react from \"eslint-plugin-react\";\n\nexport const react: Linter.Config[] = [\n {\n files: [\"**/*.{js,cjs,mjs,ts,mts,jsx,tsx}\"],\n plugins: {\n react: _react as ESLint.Plugin,\n },\n languageOptions: {\n parserOptions: {\n ecmaFeatures: {\n jsx: true,\n },\n },\n },\n settings: {\n react: {\n version: \"detect\",\n },\n },\n rules: {\n // This one is not needed any longer as TypeScript jsx option\n // should be set to react-jsx. You will need to turn this on\n // manually if it is set to the legacy react setting. See\n // https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#whats-different-in-the-new-transform\n \"react/react-in-jsx-scope\": \"off\",\n },\n },\n];\n","import type { Linter } from \"eslint\";\nimport ts from \"typescript-eslint\";\n\nexport const typescript = [\n ...ts.configs.recommended,\n {\n rules: {\n // We want to be able to use a single build system for most things.\n // Ideally, we can use vite to build all project types so we don't\n // have 4 different build systems across different projects. Thus\n // we need to make sure that swc, esbuild, and tsc are supported.\n // Forcing type imports ensures this.\n \"@typescript-eslint/consistent-type-imports\": [\n \"error\",\n { prefer: \"type-imports\" },\n ],\n // There are times when any and legacy namespaces makes sense.\n // If you use any kind of decorator library, you will almost\n // be required to use any at some point. Forcing a non use of them\n // means you're spending a bunch of time play type gymnastics and to\n // hell with that.\n \"@typescript-eslint/no-explicit-any\": \"off\",\n \"@typescript-eslint/no-namespace\": \"off\",\n\n // Would be fine, but there's a bug in this where you have a function with\n // access arguments. Those constructors are often empty - so we want to let\n // a part of this one through.\n \"no-empty-function\": \"off\",\n \"@typescript-eslint/no-empty-function\": [\n \"error\",\n { allow: [\"constructors\"] },\n ],\n\n // A lot of 3rd party libraries still don't support esm\n // and trying to force this right now just isn't feasible.\n \"@typescript-eslint/no-var-requires\": \"off\",\n \"@typescript-eslint/no-require-imports\": \"off\",\n\n // I want aliasing support.\n \"@typescript-eslint/no-empty-object-type\": \"off\",\n \"@typescript-eslint/no-empty-interface\": \"off\",\n\n // You will need unsafe declaration merging if you are doing anything\n // with decorators as what often happens is that TypeScript cannot infer\n // the output type of a decorator. So this has to be on to deal with\n // TypeScripts shortcoming in this department. See\n // https://github.com/microsoft/TypeScript/issues/4881 for more information.\n \"@typescript-eslint/no-unsafe-declaration-merging\": \"off\",\n\n // I can technically agree with this, but where this comes in\n // handy is unit testing and I value that, so I want support\n // to make the assumption that I know what I'm doing when\n // I make a non-null assertion.\n \"@typescript-eslint/no-non-null-assertion\": \"off\",\n\n // This is actually fine, but this is broken in typescript eslint 8.14.x.\n // See https://github.com/typescript-eslint/typescript-eslint/issues/10353\n // for the bug.\n \"no-unused-expressions\": \"off\",\n \"@typescript-eslint/no-unused-expressions\": [\n \"error\",\n {\n allowShortCircuit: false,\n },\n ],\n },\n } satisfies Linter.Config,\n];\n","import { imports } from \"./imports.mjs\";\nimport { javascript } from \"./javascript.mjs\";\nimport { prettier } from \"./prettier.mjs\";\nimport { typescript } from \"./typescript.mjs\";\n\nexport const recommended = [\n ...javascript,\n ...typescript,\n ...imports,\n ...prettier,\n];\n"],"names":["environment","
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/configs/environments.mts","../src/configs/imports.mts","../src/configs/javascript.mts","../src/configs/prettier.mts","../src/configs/react.mts","../src/configs/typescript.mts","../src/configs/recommended.mts"],"sourcesContent":["import type { Linter } from \"eslint\";\nimport globals from \"globals\";\n\nfunction environment(environment: object): Linter.Config {\n return {\n languageOptions: {\n globals: {\n ...environment,\n },\n },\n };\n}\n\nexport const environments = {\n browser: [environment(globals.browser)],\n node: [environment(globals.node), environment(globals.nodeBuiltin)],\n};\n","import type { Linter } from \"eslint\";\nimport _import from \"eslint-plugin-import\";\n\nexport const imports: Linter.Config[] = [\n _import.flatConfigs.recommended,\n {\n rules: {\n // This lint error is the main reason to use import as we want to make\n // sure we've installed our dependencies correctly.\n \"import/no-extraneous-dependencies\": \"error\",\n\n // These are straight up broken with Typescript when you need to work with\n // mts files that must have the file extension present. These can be fixed\n // using resolves, but it's such a pain and it's just not worth the hassle\n // for basic linting support. The no-extraneous-dependencies is really\n // the recommended config we want, so these being forced off are fine.\n \"import/named\": \"off\",\n \"import/no-unresolved\": \"off\",\n },\n } satisfies Linter.Config,\n];\n","import js from \"@eslint/js\";\nimport type { Linter } from \"eslint\";\n\nexport const javascript: Linter.Config[] = [\n js.configs.recommended,\n {\n rules: {\n // We want to support == null so we get a good check for undefined\n // or null\n eqeqeq: [\"error\", \"smart\"],\n // Would be fine, but there's a bug in this where you have a function with\n // access arguments. Those constructors are often empty - so we want to let\n // a part of this one through.\n \"no-empty-function\": \"off\",\n },\n },\n];\n","import pretty from \"eslint-plugin-prettier/recommended\";\n\nexport const prettier = [pretty];\n","import type { ESLint, Linter } from \"eslint\";\nimport _react from \"eslint-plugin-react\";\n\nexport const react: Linter.Config[] = [\n {\n files: [\"**/*.{js,cjs,mjs,ts,mts,jsx,tsx}\"],\n plugins: {\n react: _react as ESLint.Plugin,\n },\n languageOptions: {\n parserOptions: {\n ecmaFeatures: {\n jsx: true,\n },\n },\n },\n settings: {\n react: {\n version: \"detect\",\n },\n },\n rules: {\n // This one is not needed any longer as TypeScript jsx option\n // should be set to react-jsx. You will need to turn this on\n // manually if it is set to the legacy react setting. See\n // https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#whats-different-in-the-new-transform\n \"react/react-in-jsx-scope\": \"off\",\n },\n },\n];\n","import type { Linter } from \"eslint\";\nimport ts from \"typescript-eslint\";\n\nexport const typescript = [\n ...ts.configs.recommended,\n {\n rules: {\n // We want to be able to use a single build system for most things.\n // Ideally, we can use vite to build all project types so we don't\n // have 4 different build systems across different projects. Thus\n // we need to make sure that swc, esbuild, and tsc are supported.\n // Forcing type imports ensures this.\n \"@typescript-eslint/consistent-type-imports\": [\n \"error\",\n { prefer: \"type-imports\" },\n ],\n // There are times when any and legacy namespaces makes sense.\n // If you use any kind of decorator library, you will almost\n // be required to use any at some point. Forcing a non use of them\n // means you're spending a bunch of time play type gymnastics and to\n // hell with that.\n \"@typescript-eslint/no-explicit-any\": \"off\",\n \"@typescript-eslint/no-namespace\": \"off\",\n\n // Would be fine, but there's a bug in this where you have a function with\n // access arguments. Those constructors are often empty - so we want to let\n // a part of this one through.\n \"no-empty-function\": \"off\",\n \"@typescript-eslint/no-empty-function\": [\n \"error\",\n { allow: [\"constructors\"] },\n ],\n\n // A lot of 3rd party libraries still don't support esm\n // and trying to force this right now just isn't feasible.\n \"@typescript-eslint/no-var-requires\": \"off\",\n \"@typescript-eslint/no-require-imports\": \"off\",\n\n // I want aliasing support.\n \"@typescript-eslint/no-empty-object-type\": \"off\",\n \"@typescript-eslint/no-empty-interface\": \"off\",\n\n // You will need unsafe declaration merging if you are doing anything\n // with decorators as what often happens is that TypeScript cannot infer\n // the output type of a decorator. So this has to be on to deal with\n // TypeScripts shortcoming in this department. See\n // https://github.com/microsoft/TypeScript/issues/4881 for more information.\n \"@typescript-eslint/no-unsafe-declaration-merging\": \"off\",\n\n // I can technically agree with this, but where this comes in\n // handy is unit testing and I value that, so I want support\n // to make the assumption that I know what I'm doing when\n // I make a non-null assertion.\n \"@typescript-eslint/no-non-null-assertion\": \"off\",\n\n // This is actually fine, but this is broken in typescript eslint 8.14.x.\n // See https://github.com/typescript-eslint/typescript-eslint/issues/10353\n // for the bug.\n \"no-unused-expressions\": \"off\",\n \"@typescript-eslint/no-unused-expressions\": [\n \"error\",\n {\n allowShortCircuit: false,\n },\n ],\n },\n } satisfies Linter.Config,\n];\n","import { imports } from \"./imports.mjs\";\nimport { javascript } from \"./javascript.mjs\";\nimport { prettier } from \"./prettier.mjs\";\nimport { typescript } from \"./typescript.mjs\";\n\nexport const recommended = [\n ...javascript,\n ...typescript,\n ...imports,\n ...prettier,\n];\n"],"names":["environment"],"mappings":";;;;;;;;AAGA,SAAS,YAAYA,cAAoC;AAChD,SAAA;AAAA,IACL,iBAAiB;AAAA,MACf,SAAS;AAAA,QACP,GAAGA;AAAAA,MAAA;AAAA,IACL;AAAA,EAEJ;AACF;AAEO,MAAM,eAAe;AAAA,EAC1B,SAAS,CAAC,YAAY,QAAQ,OAAO,CAAC;AAAA,EACtC,MAAM,CAAC,YAAY,QAAQ,IAAI,GAAG,YAAY,QAAQ,WAAW,CAAC;AACpE;ACbO,MAAM,UAA2B;AAAA,EACtC,QAAQ,YAAY;AAAA,EACpB;AAAA,IACE,OAAO;AAAA;AAAA;AAAA,MAGL,qCAAqC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOrC,gBAAgB;AAAA,MAChB,wBAAwB;AAAA,IAAA;AAAA,EAC1B;AAEJ;ACjBO,MAAM,aAA8B;AAAA,EACzC,GAAG,QAAQ;AAAA,EACX;AAAA,IACE,OAAO;AAAA;AAAA;AAAA,MAGL,QAAQ,CAAC,SAAS,OAAO;AAAA;AAAA;AAAA;AAAA,MAIzB,qBAAqB;AAAA,IAAA;AAAA,EACvB;AAEJ;ACda,MAAA,WAAW,CAAC,MAAM;ACCxB,MAAM,QAAyB;AAAA,EACpC;AAAA,IACE,OAAO,CAAC,kCAAkC;AAAA,IAC1C,SAAS;AAAA,MACP,OAAO;AAAA,IACT;AAAA,IACA,iBAAiB;AAAA,MACf,eAAe;AAAA,QACb,cAAc;AAAA,UACZ,KAAK;AAAA,QAAA;AAAA,MACP;AAAA,IAEJ;AAAA,IACA,UAAU;AAAA,MACR,OAAO;AAAA,QACL,SAAS;AAAA,MAAA;AAAA,IAEb;AAAA,IACA,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,MAKL,4BAA4B;AAAA,IAAA;AAAA,EAC9B;AAEJ;AC1BO,MAAM,aAAa;AAAA,EACxB,GAAG,GAAG,QAAQ;AAAA,EACd;AAAA,IACE,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAML,8CAA8C;AAAA,QAC5C;AAAA,QACA,EAAE,QAAQ,eAAe;AAAA,MAC3B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMA,sCAAsC;AAAA,MACtC,mCAAmC;AAAA;AAAA;AAAA;AAAA,MAKnC,qBAAqB;AAAA,MACrB,wCAAwC;AAAA,QACtC;AAAA,QACA,EAAE,OAAO,CAAC,cAAc,EAAE;AAAA,MAC5B;AAAA;AAAA;AAAA,MAIA,sCAAsC;AAAA,MACtC,yCAAyC;AAAA;AAAA,MAGzC,2CAA2C;AAAA,MAC3C,yCAAyC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOzC,oDAAoD;AAAA;AAAA;AAAA;AAAA;AAAA,MAMpD,4CAA4C;AAAA;AAAA;AAAA;AAAA,MAK5C,yBAAyB;AAAA,MACzB,4CAA4C;AAAA,QAC1C;AAAA,QACA;AAAA,UACE,mBAAmB;AAAA,QAAA;AAAA,MACrB;AAAA,IACF;AAAA,EACF;AAEJ;AC9DO,MAAM,cAAc;AAAA,EACzB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;;;;;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -1,197 +1,153 @@
|
|
|
1
|
-
import globals from
|
|
2
|
-
import _import from
|
|
3
|
-
import js from
|
|
4
|
-
import pretty from
|
|
5
|
-
import _react from
|
|
6
|
-
import ts from
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
configurable: true,
|
|
14
|
-
writable: true
|
|
15
|
-
});
|
|
16
|
-
} else {
|
|
17
|
-
obj[key] = value;
|
|
1
|
+
import globals from "globals";
|
|
2
|
+
import _import from "eslint-plugin-import";
|
|
3
|
+
import js from "@eslint/js";
|
|
4
|
+
import pretty from "eslint-plugin-prettier/recommended";
|
|
5
|
+
import _react from "eslint-plugin-react";
|
|
6
|
+
import ts from "typescript-eslint";
|
|
7
|
+
function environment(environment2) {
|
|
8
|
+
return {
|
|
9
|
+
languageOptions: {
|
|
10
|
+
globals: {
|
|
11
|
+
...environment2
|
|
12
|
+
}
|
|
18
13
|
}
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
function _object_spread(target) {
|
|
22
|
-
for(var i = 1; i < arguments.length; i++){
|
|
23
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
24
|
-
var ownKeys = Object.keys(source);
|
|
25
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
26
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
27
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
28
|
-
}));
|
|
29
|
-
}
|
|
30
|
-
ownKeys.forEach(function(key) {
|
|
31
|
-
_define_property(target, key, source[key]);
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
return target;
|
|
35
|
-
}
|
|
36
|
-
function environment(environment) {
|
|
37
|
-
return {
|
|
38
|
-
languageOptions: {
|
|
39
|
-
globals: _object_spread({}, environment)
|
|
40
|
-
}
|
|
41
|
-
};
|
|
14
|
+
};
|
|
42
15
|
}
|
|
43
16
|
const environments = {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
],
|
|
47
|
-
node: [
|
|
48
|
-
environment(globals.node),
|
|
49
|
-
environment(globals.nodeBuiltin)
|
|
50
|
-
]
|
|
17
|
+
browser: [environment(globals.browser)],
|
|
18
|
+
node: [environment(globals.node), environment(globals.nodeBuiltin)]
|
|
51
19
|
};
|
|
52
|
-
|
|
53
20
|
const imports = [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
21
|
+
_import.flatConfigs.recommended,
|
|
22
|
+
{
|
|
23
|
+
rules: {
|
|
24
|
+
// This lint error is the main reason to use import as we want to make
|
|
25
|
+
// sure we've installed our dependencies correctly.
|
|
26
|
+
"import/no-extraneous-dependencies": "error",
|
|
27
|
+
// These are straight up broken with Typescript when you need to work with
|
|
28
|
+
// mts files that must have the file extension present. These can be fixed
|
|
29
|
+
// using resolves, but it's such a pain and it's just not worth the hassle
|
|
30
|
+
// for basic linting support. The no-extraneous-dependencies is really
|
|
31
|
+
// the recommended config we want, so these being forced off are fine.
|
|
32
|
+
"import/named": "off",
|
|
33
|
+
"import/no-unresolved": "off"
|
|
68
34
|
}
|
|
35
|
+
}
|
|
69
36
|
];
|
|
70
|
-
|
|
71
37
|
const javascript = [
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
// access arguments. Those constructors are often empty - so we want to let
|
|
83
|
-
// a part of this one through.
|
|
84
|
-
"no-empty-function": "off"
|
|
85
|
-
}
|
|
38
|
+
js.configs.recommended,
|
|
39
|
+
{
|
|
40
|
+
rules: {
|
|
41
|
+
// We want to support == null so we get a good check for undefined
|
|
42
|
+
// or null
|
|
43
|
+
eqeqeq: ["error", "smart"],
|
|
44
|
+
// Would be fine, but there's a bug in this where you have a function with
|
|
45
|
+
// access arguments. Those constructors are often empty - so we want to let
|
|
46
|
+
// a part of this one through.
|
|
47
|
+
"no-empty-function": "off"
|
|
86
48
|
}
|
|
49
|
+
}
|
|
87
50
|
];
|
|
88
|
-
|
|
89
|
-
const prettier = [
|
|
90
|
-
pretty
|
|
91
|
-
];
|
|
92
|
-
|
|
51
|
+
const prettier = [pretty];
|
|
93
52
|
const react = [
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
ecmaFeatures: {
|
|
104
|
-
jsx: true
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
settings: {
|
|
109
|
-
react: {
|
|
110
|
-
version: "detect"
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
rules: {
|
|
114
|
-
// This one is not needed any longer as TypeScript jsx option
|
|
115
|
-
// should be set to react-jsx. You will need to turn this on
|
|
116
|
-
// manually if it is set to the legacy react setting. See
|
|
117
|
-
// https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#whats-different-in-the-new-transform
|
|
118
|
-
"react/react-in-jsx-scope": "off"
|
|
53
|
+
{
|
|
54
|
+
files: ["**/*.{js,cjs,mjs,ts,mts,jsx,tsx}"],
|
|
55
|
+
plugins: {
|
|
56
|
+
react: _react
|
|
57
|
+
},
|
|
58
|
+
languageOptions: {
|
|
59
|
+
parserOptions: {
|
|
60
|
+
ecmaFeatures: {
|
|
61
|
+
jsx: true
|
|
119
62
|
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
settings: {
|
|
66
|
+
react: {
|
|
67
|
+
version: "detect"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
rules: {
|
|
71
|
+
// This one is not needed any longer as TypeScript jsx option
|
|
72
|
+
// should be set to react-jsx. You will need to turn this on
|
|
73
|
+
// manually if it is set to the legacy react setting. See
|
|
74
|
+
// https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#whats-different-in-the-new-transform
|
|
75
|
+
"react/react-in-jsx-scope": "off"
|
|
120
76
|
}
|
|
77
|
+
}
|
|
121
78
|
];
|
|
122
|
-
|
|
123
79
|
const typescript = [
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
// for the bug.
|
|
178
|
-
"no-unused-expressions": "off",
|
|
179
|
-
"@typescript-eslint/no-unused-expressions": [
|
|
180
|
-
"error",
|
|
181
|
-
{
|
|
182
|
-
allowShortCircuit: false
|
|
183
|
-
}
|
|
184
|
-
]
|
|
80
|
+
...ts.configs.recommended,
|
|
81
|
+
{
|
|
82
|
+
rules: {
|
|
83
|
+
// We want to be able to use a single build system for most things.
|
|
84
|
+
// Ideally, we can use vite to build all project types so we don't
|
|
85
|
+
// have 4 different build systems across different projects. Thus
|
|
86
|
+
// we need to make sure that swc, esbuild, and tsc are supported.
|
|
87
|
+
// Forcing type imports ensures this.
|
|
88
|
+
"@typescript-eslint/consistent-type-imports": [
|
|
89
|
+
"error",
|
|
90
|
+
{ prefer: "type-imports" }
|
|
91
|
+
],
|
|
92
|
+
// There are times when any and legacy namespaces makes sense.
|
|
93
|
+
// If you use any kind of decorator library, you will almost
|
|
94
|
+
// be required to use any at some point. Forcing a non use of them
|
|
95
|
+
// means you're spending a bunch of time play type gymnastics and to
|
|
96
|
+
// hell with that.
|
|
97
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
98
|
+
"@typescript-eslint/no-namespace": "off",
|
|
99
|
+
// Would be fine, but there's a bug in this where you have a function with
|
|
100
|
+
// access arguments. Those constructors are often empty - so we want to let
|
|
101
|
+
// a part of this one through.
|
|
102
|
+
"no-empty-function": "off",
|
|
103
|
+
"@typescript-eslint/no-empty-function": [
|
|
104
|
+
"error",
|
|
105
|
+
{ allow: ["constructors"] }
|
|
106
|
+
],
|
|
107
|
+
// A lot of 3rd party libraries still don't support esm
|
|
108
|
+
// and trying to force this right now just isn't feasible.
|
|
109
|
+
"@typescript-eslint/no-var-requires": "off",
|
|
110
|
+
"@typescript-eslint/no-require-imports": "off",
|
|
111
|
+
// I want aliasing support.
|
|
112
|
+
"@typescript-eslint/no-empty-object-type": "off",
|
|
113
|
+
"@typescript-eslint/no-empty-interface": "off",
|
|
114
|
+
// You will need unsafe declaration merging if you are doing anything
|
|
115
|
+
// with decorators as what often happens is that TypeScript cannot infer
|
|
116
|
+
// the output type of a decorator. So this has to be on to deal with
|
|
117
|
+
// TypeScripts shortcoming in this department. See
|
|
118
|
+
// https://github.com/microsoft/TypeScript/issues/4881 for more information.
|
|
119
|
+
"@typescript-eslint/no-unsafe-declaration-merging": "off",
|
|
120
|
+
// I can technically agree with this, but where this comes in
|
|
121
|
+
// handy is unit testing and I value that, so I want support
|
|
122
|
+
// to make the assumption that I know what I'm doing when
|
|
123
|
+
// I make a non-null assertion.
|
|
124
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
125
|
+
// This is actually fine, but this is broken in typescript eslint 8.14.x.
|
|
126
|
+
// See https://github.com/typescript-eslint/typescript-eslint/issues/10353
|
|
127
|
+
// for the bug.
|
|
128
|
+
"no-unused-expressions": "off",
|
|
129
|
+
"@typescript-eslint/no-unused-expressions": [
|
|
130
|
+
"error",
|
|
131
|
+
{
|
|
132
|
+
allowShortCircuit: false
|
|
185
133
|
}
|
|
134
|
+
]
|
|
186
135
|
}
|
|
136
|
+
}
|
|
187
137
|
];
|
|
188
|
-
|
|
189
138
|
const recommended = [
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
139
|
+
...javascript,
|
|
140
|
+
...typescript,
|
|
141
|
+
...imports,
|
|
142
|
+
...prettier
|
|
194
143
|
];
|
|
195
|
-
|
|
196
|
-
|
|
144
|
+
export {
|
|
145
|
+
environments,
|
|
146
|
+
imports,
|
|
147
|
+
javascript,
|
|
148
|
+
prettier,
|
|
149
|
+
react,
|
|
150
|
+
recommended,
|
|
151
|
+
typescript
|
|
152
|
+
};
|
|
197
153
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/configs/environments.mts","../src/configs/imports.mts","../src/configs/javascript.mts","../src/configs/prettier.mts","../src/configs/react.mts","../src/configs/typescript.mts","../src/configs/recommended.mts"],"sourcesContent":["import type { Linter } from \"eslint\";\nimport globals from \"globals\";\n\nfunction environment(environment: object): Linter.Config {\n return {\n languageOptions: {\n globals: {\n ...environment,\n },\n },\n };\n}\n\nexport const environments = {\n browser: [environment(globals.browser)],\n node: [environment(globals.node), environment(globals.nodeBuiltin)],\n};\n","import type { Linter } from \"eslint\";\nimport _import from \"eslint-plugin-import\";\n\nexport const imports: Linter.Config[] = [\n _import.flatConfigs.recommended,\n {\n rules: {\n // This lint error is the main reason to use import as we want to make\n // sure we've installed our dependencies correctly.\n \"import/no-extraneous-dependencies\": \"error\",\n\n // These are straight up broken with Typescript when you need to work with\n // mts files that must have the file extension present. These can be fixed\n // using resolves, but it's such a pain and it's just not worth the hassle\n // for basic linting support. The no-extraneous-dependencies is really\n // the recommended config we want, so these being forced off are fine.\n \"import/named\": \"off\",\n \"import/no-unresolved\": \"off\",\n },\n } satisfies Linter.Config,\n];\n","import js from \"@eslint/js\";\nimport type { Linter } from \"eslint\";\n\nexport const javascript: Linter.Config[] = [\n js.configs.recommended,\n {\n rules: {\n // We want to support == null so we get a good check for undefined\n // or null\n eqeqeq: [\"error\", \"smart\"],\n // Would be fine, but there's a bug in this where you have a function with\n // access arguments. Those constructors are often empty - so we want to let\n // a part of this one through.\n \"no-empty-function\": \"off\",\n },\n },\n];\n","import pretty from \"eslint-plugin-prettier/recommended\";\n\nexport const prettier = [pretty];\n","import type { ESLint, Linter } from \"eslint\";\nimport _react from \"eslint-plugin-react\";\n\nexport const react: Linter.Config[] = [\n {\n files: [\"**/*.{js,cjs,mjs,ts,mts,jsx,tsx}\"],\n plugins: {\n react: _react as ESLint.Plugin,\n },\n languageOptions: {\n parserOptions: {\n ecmaFeatures: {\n jsx: true,\n },\n },\n },\n settings: {\n react: {\n version: \"detect\",\n },\n },\n rules: {\n // This one is not needed any longer as TypeScript jsx option\n // should be set to react-jsx. You will need to turn this on\n // manually if it is set to the legacy react setting. See\n // https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#whats-different-in-the-new-transform\n \"react/react-in-jsx-scope\": \"off\",\n },\n },\n];\n","import type { Linter } from \"eslint\";\nimport ts from \"typescript-eslint\";\n\nexport const typescript = [\n ...ts.configs.recommended,\n {\n rules: {\n // We want to be able to use a single build system for most things.\n // Ideally, we can use vite to build all project types so we don't\n // have 4 different build systems across different projects. Thus\n // we need to make sure that swc, esbuild, and tsc are supported.\n // Forcing type imports ensures this.\n \"@typescript-eslint/consistent-type-imports\": [\n \"error\",\n { prefer: \"type-imports\" },\n ],\n // There are times when any and legacy namespaces makes sense.\n // If you use any kind of decorator library, you will almost\n // be required to use any at some point. Forcing a non use of them\n // means you're spending a bunch of time play type gymnastics and to\n // hell with that.\n \"@typescript-eslint/no-explicit-any\": \"off\",\n \"@typescript-eslint/no-namespace\": \"off\",\n\n // Would be fine, but there's a bug in this where you have a function with\n // access arguments. Those constructors are often empty - so we want to let\n // a part of this one through.\n \"no-empty-function\": \"off\",\n \"@typescript-eslint/no-empty-function\": [\n \"error\",\n { allow: [\"constructors\"] },\n ],\n\n // A lot of 3rd party libraries still don't support esm\n // and trying to force this right now just isn't feasible.\n \"@typescript-eslint/no-var-requires\": \"off\",\n \"@typescript-eslint/no-require-imports\": \"off\",\n\n // I want aliasing support.\n \"@typescript-eslint/no-empty-object-type\": \"off\",\n \"@typescript-eslint/no-empty-interface\": \"off\",\n\n // You will need unsafe declaration merging if you are doing anything\n // with decorators as what often happens is that TypeScript cannot infer\n // the output type of a decorator. So this has to be on to deal with\n // TypeScripts shortcoming in this department. See\n // https://github.com/microsoft/TypeScript/issues/4881 for more information.\n \"@typescript-eslint/no-unsafe-declaration-merging\": \"off\",\n\n // I can technically agree with this, but where this comes in\n // handy is unit testing and I value that, so I want support\n // to make the assumption that I know what I'm doing when\n // I make a non-null assertion.\n \"@typescript-eslint/no-non-null-assertion\": \"off\",\n\n // This is actually fine, but this is broken in typescript eslint 8.14.x.\n // See https://github.com/typescript-eslint/typescript-eslint/issues/10353\n // for the bug.\n \"no-unused-expressions\": \"off\",\n \"@typescript-eslint/no-unused-expressions\": [\n \"error\",\n {\n allowShortCircuit: false,\n },\n ],\n },\n } satisfies Linter.Config,\n];\n","import { imports } from \"./imports.mjs\";\nimport { javascript } from \"./javascript.mjs\";\nimport { prettier } from \"./prettier.mjs\";\nimport { typescript } from \"./typescript.mjs\";\n\nexport const recommended = [\n ...javascript,\n ...typescript,\n ...imports,\n ...prettier,\n];\n"],"names":["environment","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/configs/environments.mts","../src/configs/imports.mts","../src/configs/javascript.mts","../src/configs/prettier.mts","../src/configs/react.mts","../src/configs/typescript.mts","../src/configs/recommended.mts"],"sourcesContent":["import type { Linter } from \"eslint\";\nimport globals from \"globals\";\n\nfunction environment(environment: object): Linter.Config {\n return {\n languageOptions: {\n globals: {\n ...environment,\n },\n },\n };\n}\n\nexport const environments = {\n browser: [environment(globals.browser)],\n node: [environment(globals.node), environment(globals.nodeBuiltin)],\n};\n","import type { Linter } from \"eslint\";\nimport _import from \"eslint-plugin-import\";\n\nexport const imports: Linter.Config[] = [\n _import.flatConfigs.recommended,\n {\n rules: {\n // This lint error is the main reason to use import as we want to make\n // sure we've installed our dependencies correctly.\n \"import/no-extraneous-dependencies\": \"error\",\n\n // These are straight up broken with Typescript when you need to work with\n // mts files that must have the file extension present. These can be fixed\n // using resolves, but it's such a pain and it's just not worth the hassle\n // for basic linting support. The no-extraneous-dependencies is really\n // the recommended config we want, so these being forced off are fine.\n \"import/named\": \"off\",\n \"import/no-unresolved\": \"off\",\n },\n } satisfies Linter.Config,\n];\n","import js from \"@eslint/js\";\nimport type { Linter } from \"eslint\";\n\nexport const javascript: Linter.Config[] = [\n js.configs.recommended,\n {\n rules: {\n // We want to support == null so we get a good check for undefined\n // or null\n eqeqeq: [\"error\", \"smart\"],\n // Would be fine, but there's a bug in this where you have a function with\n // access arguments. Those constructors are often empty - so we want to let\n // a part of this one through.\n \"no-empty-function\": \"off\",\n },\n },\n];\n","import pretty from \"eslint-plugin-prettier/recommended\";\n\nexport const prettier = [pretty];\n","import type { ESLint, Linter } from \"eslint\";\nimport _react from \"eslint-plugin-react\";\n\nexport const react: Linter.Config[] = [\n {\n files: [\"**/*.{js,cjs,mjs,ts,mts,jsx,tsx}\"],\n plugins: {\n react: _react as ESLint.Plugin,\n },\n languageOptions: {\n parserOptions: {\n ecmaFeatures: {\n jsx: true,\n },\n },\n },\n settings: {\n react: {\n version: \"detect\",\n },\n },\n rules: {\n // This one is not needed any longer as TypeScript jsx option\n // should be set to react-jsx. You will need to turn this on\n // manually if it is set to the legacy react setting. See\n // https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#whats-different-in-the-new-transform\n \"react/react-in-jsx-scope\": \"off\",\n },\n },\n];\n","import type { Linter } from \"eslint\";\nimport ts from \"typescript-eslint\";\n\nexport const typescript = [\n ...ts.configs.recommended,\n {\n rules: {\n // We want to be able to use a single build system for most things.\n // Ideally, we can use vite to build all project types so we don't\n // have 4 different build systems across different projects. Thus\n // we need to make sure that swc, esbuild, and tsc are supported.\n // Forcing type imports ensures this.\n \"@typescript-eslint/consistent-type-imports\": [\n \"error\",\n { prefer: \"type-imports\" },\n ],\n // There are times when any and legacy namespaces makes sense.\n // If you use any kind of decorator library, you will almost\n // be required to use any at some point. Forcing a non use of them\n // means you're spending a bunch of time play type gymnastics and to\n // hell with that.\n \"@typescript-eslint/no-explicit-any\": \"off\",\n \"@typescript-eslint/no-namespace\": \"off\",\n\n // Would be fine, but there's a bug in this where you have a function with\n // access arguments. Those constructors are often empty - so we want to let\n // a part of this one through.\n \"no-empty-function\": \"off\",\n \"@typescript-eslint/no-empty-function\": [\n \"error\",\n { allow: [\"constructors\"] },\n ],\n\n // A lot of 3rd party libraries still don't support esm\n // and trying to force this right now just isn't feasible.\n \"@typescript-eslint/no-var-requires\": \"off\",\n \"@typescript-eslint/no-require-imports\": \"off\",\n\n // I want aliasing support.\n \"@typescript-eslint/no-empty-object-type\": \"off\",\n \"@typescript-eslint/no-empty-interface\": \"off\",\n\n // You will need unsafe declaration merging if you are doing anything\n // with decorators as what often happens is that TypeScript cannot infer\n // the output type of a decorator. So this has to be on to deal with\n // TypeScripts shortcoming in this department. See\n // https://github.com/microsoft/TypeScript/issues/4881 for more information.\n \"@typescript-eslint/no-unsafe-declaration-merging\": \"off\",\n\n // I can technically agree with this, but where this comes in\n // handy is unit testing and I value that, so I want support\n // to make the assumption that I know what I'm doing when\n // I make a non-null assertion.\n \"@typescript-eslint/no-non-null-assertion\": \"off\",\n\n // This is actually fine, but this is broken in typescript eslint 8.14.x.\n // See https://github.com/typescript-eslint/typescript-eslint/issues/10353\n // for the bug.\n \"no-unused-expressions\": \"off\",\n \"@typescript-eslint/no-unused-expressions\": [\n \"error\",\n {\n allowShortCircuit: false,\n },\n ],\n },\n } satisfies Linter.Config,\n];\n","import { imports } from \"./imports.mjs\";\nimport { javascript } from \"./javascript.mjs\";\nimport { prettier } from \"./prettier.mjs\";\nimport { typescript } from \"./typescript.mjs\";\n\nexport const recommended = [\n ...javascript,\n ...typescript,\n ...imports,\n ...prettier,\n];\n"],"names":["environment"],"mappings":";;;;;;AAGA,SAAS,YAAYA,cAAoC;AAChD,SAAA;AAAA,IACL,iBAAiB;AAAA,MACf,SAAS;AAAA,QACP,GAAGA;AAAAA,MAAA;AAAA,IACL;AAAA,EAEJ;AACF;AAEO,MAAM,eAAe;AAAA,EAC1B,SAAS,CAAC,YAAY,QAAQ,OAAO,CAAC;AAAA,EACtC,MAAM,CAAC,YAAY,QAAQ,IAAI,GAAG,YAAY,QAAQ,WAAW,CAAC;AACpE;ACbO,MAAM,UAA2B;AAAA,EACtC,QAAQ,YAAY;AAAA,EACpB;AAAA,IACE,OAAO;AAAA;AAAA;AAAA,MAGL,qCAAqC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOrC,gBAAgB;AAAA,MAChB,wBAAwB;AAAA,IAAA;AAAA,EAC1B;AAEJ;ACjBO,MAAM,aAA8B;AAAA,EACzC,GAAG,QAAQ;AAAA,EACX;AAAA,IACE,OAAO;AAAA;AAAA;AAAA,MAGL,QAAQ,CAAC,SAAS,OAAO;AAAA;AAAA;AAAA;AAAA,MAIzB,qBAAqB;AAAA,IAAA;AAAA,EACvB;AAEJ;ACda,MAAA,WAAW,CAAC,MAAM;ACCxB,MAAM,QAAyB;AAAA,EACpC;AAAA,IACE,OAAO,CAAC,kCAAkC;AAAA,IAC1C,SAAS;AAAA,MACP,OAAO;AAAA,IACT;AAAA,IACA,iBAAiB;AAAA,MACf,eAAe;AAAA,QACb,cAAc;AAAA,UACZ,KAAK;AAAA,QAAA;AAAA,MACP;AAAA,IAEJ;AAAA,IACA,UAAU;AAAA,MACR,OAAO;AAAA,QACL,SAAS;AAAA,MAAA;AAAA,IAEb;AAAA,IACA,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,MAKL,4BAA4B;AAAA,IAAA;AAAA,EAC9B;AAEJ;AC1BO,MAAM,aAAa;AAAA,EACxB,GAAG,GAAG,QAAQ;AAAA,EACd;AAAA,IACE,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAML,8CAA8C;AAAA,QAC5C;AAAA,QACA,EAAE,QAAQ,eAAe;AAAA,MAC3B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMA,sCAAsC;AAAA,MACtC,mCAAmC;AAAA;AAAA;AAAA;AAAA,MAKnC,qBAAqB;AAAA,MACrB,wCAAwC;AAAA,QACtC;AAAA,QACA,EAAE,OAAO,CAAC,cAAc,EAAE;AAAA,MAC5B;AAAA;AAAA;AAAA,MAIA,sCAAsC;AAAA,MACtC,yCAAyC;AAAA;AAAA,MAGzC,2CAA2C;AAAA,MAC3C,yCAAyC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOzC,oDAAoD;AAAA;AAAA;AAAA;AAAA;AAAA,MAMpD,4CAA4C;AAAA;AAAA;AAAA;AAAA,MAK5C,yBAAyB;AAAA,MACzB,4CAA4C;AAAA,QAC1C;AAAA,QACA;AAAA,UACE,mBAAmB;AAAA,QAAA;AAAA,MACrB;AAAA,IACF;AAAA,EACF;AAEJ;AC9DO,MAAM,cAAc;AAAA,EACzB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zthun/janitor-eslint-config",
|
|
3
|
-
"version": "19.1.
|
|
3
|
+
"version": "19.1.1",
|
|
4
4
|
"description": "A shared configuration for eslint for @zthun scoped projects.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"typescript-eslint": "^8.33.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@zthun/janitor-build-config": "^19.1.
|
|
40
|
+
"@zthun/janitor-build-config": "^19.1.1",
|
|
41
41
|
"eslint": "^9.28.0",
|
|
42
42
|
"prettier": "^3.5.3",
|
|
43
43
|
"typescript": "~5.8.3",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
60
|
"author": "Anthony Bonta",
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "ad805eb1111b858e833925d150acf12e48c09b1b"
|
|
62
62
|
}
|