@zthun/janitor-eslint-config 19.5.6 → 20.0.0
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/lib/configs/environments.mjs +17 -0
- package/lib/configs/html.mjs +25 -0
- package/lib/configs/ignores.mjs +15 -0
- package/lib/configs/javascript.mjs +82 -0
- package/lib/configs/json.mjs +23 -0
- package/lib/configs/markdown.mjs +4 -0
- package/lib/configs/prettier.mjs +19 -0
- package/lib/configs/react.mjs +37 -0
- package/lib/configs/recommended.mjs +27 -0
- package/lib/configs/spelling.mjs +4 -0
- package/lib/configs/styles.mjs +12 -0
- package/lib/configs/test.mjs +19 -0
- package/lib/configs/typescript.mjs +105 -0
- package/lib/configs/yaml.mjs +4 -0
- package/lib/files/files.mjs +75 -0
- package/lib/index.d.mts +20 -0
- package/lib/index.mjs +14 -0
- package/package.json +26 -21
- package/dist/configs/environments.d.mts +0 -5
- package/dist/configs/imports.d.mts +0 -2
- package/dist/configs/javascript.d.mts +0 -2
- package/dist/configs/prettier.d.mts +0 -1
- package/dist/configs/react.d.mts +0 -2
- package/dist/configs/recommended.d.mts +0 -1
- package/dist/configs/typescript.d.mts +0 -2
- package/dist/index.cjs +0 -181
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.mts +0 -7
- package/dist/index.js +0 -171
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineConfig } from "eslint/config";
|
|
2
|
+
import globals from "globals";
|
|
3
|
+
|
|
4
|
+
function environment(environment) {
|
|
5
|
+
return defineConfig({
|
|
6
|
+
languageOptions: {
|
|
7
|
+
globals: {
|
|
8
|
+
...environment,
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const environments = {
|
|
15
|
+
browser: [...environment(globals.browser)],
|
|
16
|
+
node: [...environment(globals.node), ...environment(globals.nodeBuiltin)],
|
|
17
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import css from "@eslint/css";
|
|
2
|
+
import _html from "@html-eslint/eslint-plugin";
|
|
3
|
+
import { defineConfig } from "eslint/config";
|
|
4
|
+
|
|
5
|
+
import { ExtCss, ExtHtml, files } from "../files/files.mjs";
|
|
6
|
+
|
|
7
|
+
export const html = defineConfig([
|
|
8
|
+
{
|
|
9
|
+
..._html.configs["flat/recommended"],
|
|
10
|
+
files: files(...ExtHtml),
|
|
11
|
+
language: "@html-eslint/html",
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
files: files(...ExtHtml),
|
|
15
|
+
rules: {
|
|
16
|
+
// Prettier defaults to 2 spaces, so this needs to as well.
|
|
17
|
+
"@html-eslint/indent": ["error", 2],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
...css.configs.recommended,
|
|
22
|
+
files: files(...ExtCss),
|
|
23
|
+
language: "css/css",
|
|
24
|
+
},
|
|
25
|
+
]);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineConfig, globalIgnores } from "eslint/config";
|
|
2
|
+
|
|
3
|
+
export const ignores = defineConfig([
|
|
4
|
+
globalIgnores([
|
|
5
|
+
// Outputs
|
|
6
|
+
"**/dist",
|
|
7
|
+
"**/node_modules",
|
|
8
|
+
"**/coverage",
|
|
9
|
+
"**/CHANGELOG.md",
|
|
10
|
+
|
|
11
|
+
// Generated
|
|
12
|
+
"**/.yarn",
|
|
13
|
+
"**/*.husky",
|
|
14
|
+
]),
|
|
15
|
+
]);
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import js from "@eslint/js";
|
|
2
|
+
import { defineConfig } from "eslint/config";
|
|
3
|
+
import _import from "eslint-plugin-import";
|
|
4
|
+
import _simple from "eslint-plugin-simple-import-sort";
|
|
5
|
+
import _unused from "eslint-plugin-unused-imports";
|
|
6
|
+
|
|
7
|
+
import { ExtEs, files } from "../files/files.mjs";
|
|
8
|
+
|
|
9
|
+
export const javascript = defineConfig([
|
|
10
|
+
{
|
|
11
|
+
...js.configs.recommended,
|
|
12
|
+
files: files(...ExtEs),
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
files: files(...ExtEs),
|
|
16
|
+
rules: {
|
|
17
|
+
// We want to support == null so we get a good check for undefined
|
|
18
|
+
// or null
|
|
19
|
+
eqeqeq: ["error", "smart"],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
..._import.flatConfigs.recommended,
|
|
24
|
+
files: files(...ExtEs),
|
|
25
|
+
languageOptions: {
|
|
26
|
+
parserOptions: {
|
|
27
|
+
// The ecma version from the import config is 2018, and we
|
|
28
|
+
// want some later features. This should support
|
|
29
|
+
// our current version that janitor-ts-config supports
|
|
30
|
+
// by default.
|
|
31
|
+
ecmaVersion: 2022,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
files: files(...ExtEs),
|
|
37
|
+
rules: {
|
|
38
|
+
// This lint error is the main reason to use import as we want to make
|
|
39
|
+
// sure we've installed our dependencies correctly.
|
|
40
|
+
"import/no-extraneous-dependencies": "error",
|
|
41
|
+
|
|
42
|
+
// These are straight up broken with Typescript when you need to work with
|
|
43
|
+
// mts files that must have the file extension present. These can be fixed
|
|
44
|
+
// using resolves, but it's such a pain and it's just not worth the hassle
|
|
45
|
+
// for basic linting support. The no-extraneous-dependencies is really
|
|
46
|
+
// the recommended config we want, so these being forced off are fine.
|
|
47
|
+
"import/named": "off",
|
|
48
|
+
"import/no-unresolved": "off",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
files: files(...ExtEs),
|
|
53
|
+
plugins: {
|
|
54
|
+
"simple-import-sort": _simple,
|
|
55
|
+
},
|
|
56
|
+
rules: {
|
|
57
|
+
// The simple import sort plugin is mostly here for sorting the imports
|
|
58
|
+
// with fix support. The option, import/order does something similar
|
|
59
|
+
// and is much more configurable, but it doesn't support sorting exports
|
|
60
|
+
// Simple import sort is much more config free and basic and it's grouping
|
|
61
|
+
// is just fine, so we are using this instead of the more complex
|
|
62
|
+
// alternative.
|
|
63
|
+
"simple-import-sort/imports": "error",
|
|
64
|
+
"simple-import-sort/exports": "error",
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
files: files(...ExtEs),
|
|
69
|
+
|
|
70
|
+
plugins: {
|
|
71
|
+
"unused-imports": _unused,
|
|
72
|
+
},
|
|
73
|
+
rules: {
|
|
74
|
+
// This is the same as import/no-unused-modules, but that one does not
|
|
75
|
+
// auto fix when it's detected and this one does, so we are favoring this
|
|
76
|
+
// one instead. We're turning off no-unused-modules in case the default
|
|
77
|
+
// recommended config ever turns it on.
|
|
78
|
+
"import/no-unused-modules": "off",
|
|
79
|
+
"unused-imports/no-unused-imports": "error",
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
]);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import _json from "@eslint/json";
|
|
2
|
+
import { defineConfig } from "eslint/config";
|
|
3
|
+
|
|
4
|
+
import { ExtJson, files } from "../files/files.mjs";
|
|
5
|
+
|
|
6
|
+
export const json = defineConfig([
|
|
7
|
+
{
|
|
8
|
+
..._json.configs.recommended,
|
|
9
|
+
files: files(...ExtJson),
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
files: files("json"),
|
|
13
|
+
language: "json/json",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
files: files("jsonc"),
|
|
17
|
+
language: "json/jsonc",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
files: files("json5"),
|
|
21
|
+
language: "json/json5",
|
|
22
|
+
},
|
|
23
|
+
]);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineConfig } from "eslint/config";
|
|
2
|
+
import pretty from "eslint-plugin-prettier/recommended";
|
|
3
|
+
|
|
4
|
+
export const prettier = defineConfig([
|
|
5
|
+
pretty,
|
|
6
|
+
{
|
|
7
|
+
rules: {
|
|
8
|
+
"prettier/prettier": [
|
|
9
|
+
"error",
|
|
10
|
+
{
|
|
11
|
+
// If you don't set proseWrap to always, markdown
|
|
12
|
+
// does not line break properly, so we are setting it
|
|
13
|
+
// here.
|
|
14
|
+
proseWrap: "always",
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
]);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { defineConfig } from "eslint/config";
|
|
2
|
+
import _react from "eslint-plugin-react";
|
|
3
|
+
import _hooks from "eslint-plugin-react-hooks";
|
|
4
|
+
|
|
5
|
+
import { ExtEs, files } from "../files/files.mjs";
|
|
6
|
+
|
|
7
|
+
export const react = defineConfig([
|
|
8
|
+
{
|
|
9
|
+
files: files(...ExtEs),
|
|
10
|
+
settings: {
|
|
11
|
+
react: {
|
|
12
|
+
version: "detect",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
..._react.configs.flat.recommended,
|
|
18
|
+
files: files(...ExtEs),
|
|
19
|
+
rules: {
|
|
20
|
+
// This one is not needed any longer as TypeScript jsx option
|
|
21
|
+
// should be set to react-jsx. You will need to turn this on
|
|
22
|
+
// manually if it is set to the legacy react setting. See
|
|
23
|
+
// https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#whats-different-in-the-new-transform
|
|
24
|
+
"react/react-in-jsx-scope": "off",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
..._hooks.configs.flat.recommended,
|
|
29
|
+
files: files(...ExtEs),
|
|
30
|
+
rules: {
|
|
31
|
+
// There are times when refs are appropriate, especially if you are using
|
|
32
|
+
// html dialog based elements, which you will most likely need to use
|
|
33
|
+
// refs to move or focus.
|
|
34
|
+
"react-hooks/refs": "off",
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
]);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineConfig } from "eslint/config";
|
|
2
|
+
|
|
3
|
+
import { html } from "./html.mjs";
|
|
4
|
+
import { ignores } from "./ignores.mjs";
|
|
5
|
+
import { javascript } from "./javascript.mjs";
|
|
6
|
+
import { json } from "./json.mjs";
|
|
7
|
+
import { markdown } from "./markdown.mjs";
|
|
8
|
+
import { prettier } from "./prettier.mjs";
|
|
9
|
+
import { spelling } from "./spelling.mjs";
|
|
10
|
+
import { styles } from "./styles.mjs";
|
|
11
|
+
import { test } from "./test.mjs";
|
|
12
|
+
import { typescript } from "./typescript.mjs";
|
|
13
|
+
import { yaml } from "./yaml.mjs";
|
|
14
|
+
|
|
15
|
+
export const recommended = defineConfig([
|
|
16
|
+
...ignores,
|
|
17
|
+
...javascript,
|
|
18
|
+
...typescript,
|
|
19
|
+
...markdown,
|
|
20
|
+
...json,
|
|
21
|
+
...yaml,
|
|
22
|
+
...styles,
|
|
23
|
+
...html,
|
|
24
|
+
...test,
|
|
25
|
+
...spelling,
|
|
26
|
+
...prettier,
|
|
27
|
+
]);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import css from "@eslint/css";
|
|
2
|
+
import { defineConfig } from "eslint/config";
|
|
3
|
+
|
|
4
|
+
import { ExtCss, files } from "../files/files.mjs";
|
|
5
|
+
|
|
6
|
+
export const styles = defineConfig([
|
|
7
|
+
{
|
|
8
|
+
...css.configs.recommended,
|
|
9
|
+
files: files(...ExtCss),
|
|
10
|
+
language: "css/css",
|
|
11
|
+
},
|
|
12
|
+
]);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import vitest from "@vitest/eslint-plugin";
|
|
2
|
+
import { defineConfig } from "eslint/config";
|
|
3
|
+
|
|
4
|
+
import { ExtEs, filesTest } from "../files/files.mjs";
|
|
5
|
+
|
|
6
|
+
export const test = defineConfig([
|
|
7
|
+
{
|
|
8
|
+
...vitest.configs.recommended,
|
|
9
|
+
files: filesTest(...ExtEs),
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
files: filesTest(...ExtEs),
|
|
13
|
+
rules: {
|
|
14
|
+
// This requires an expect call in a test block, which prevents helper
|
|
15
|
+
// functions to reuse test logic. This needs to be turned off.
|
|
16
|
+
"vitest/expect-expect": "off",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
]);
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { defineConfig } from "eslint/config";
|
|
2
|
+
import { configs, parser } from "typescript-eslint";
|
|
3
|
+
|
|
4
|
+
import { ExtTs, ExtTsx, files, filesTest } from "../files/files.mjs";
|
|
5
|
+
|
|
6
|
+
// The default typescript linter recommended shared configs are
|
|
7
|
+
// absolutely terrible as they weave their way into every single
|
|
8
|
+
// file, even if the extensions make no sense. So we are going
|
|
9
|
+
// to be more selective about which files we actually will apply
|
|
10
|
+
// these rules to. We have to flatten all this mess out.
|
|
11
|
+
// Seriously, do better Microsoft.
|
|
12
|
+
const { base, eslintRecommended, recommendedTypeChecked } = configs;
|
|
13
|
+
const name = "typescript-eslint/recommended-type-checked";
|
|
14
|
+
const recommended = recommendedTypeChecked.find((x) => x.name === name) || {};
|
|
15
|
+
const { rules } = recommended;
|
|
16
|
+
|
|
17
|
+
export const typescript = defineConfig([
|
|
18
|
+
{
|
|
19
|
+
...base,
|
|
20
|
+
files: files(...ExtTs, ...ExtTsx),
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
...eslintRecommended,
|
|
24
|
+
files: files(...ExtTs, ...ExtTsx),
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
...recommended,
|
|
28
|
+
languageOptions: {
|
|
29
|
+
parser,
|
|
30
|
+
parserOptions: {
|
|
31
|
+
projectService: true,
|
|
32
|
+
},
|
|
33
|
+
sourceType: "module",
|
|
34
|
+
},
|
|
35
|
+
files: files(...ExtTs, ...ExtTsx),
|
|
36
|
+
rules: {
|
|
37
|
+
...rules,
|
|
38
|
+
// We want to be able to use a single build system for most things.
|
|
39
|
+
// Ideally, we can use vite to build all project types so we don't
|
|
40
|
+
// have 4 different build systems across different projects. Thus
|
|
41
|
+
// we need to make sure that swc, esbuild, and tsc are supported.
|
|
42
|
+
// Forcing type imports ensures this.
|
|
43
|
+
"@typescript-eslint/consistent-type-imports": [
|
|
44
|
+
"error",
|
|
45
|
+
{ prefer: "type-imports" },
|
|
46
|
+
],
|
|
47
|
+
// There are times when any and legacy namespaces makes sense.
|
|
48
|
+
// If you use any kind of decorator library, you will almost
|
|
49
|
+
// be required to use any at some point. Forcing a non use of them
|
|
50
|
+
// means you're spending a bunch of time play type gymnastics and to
|
|
51
|
+
// hell with that.
|
|
52
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
53
|
+
"@typescript-eslint/no-namespace": "off",
|
|
54
|
+
|
|
55
|
+
// Would be fine, but there's a bug in this where you have a function with
|
|
56
|
+
// access arguments. Those constructors are often empty - so we want to let
|
|
57
|
+
// a part of this one through.
|
|
58
|
+
"no-empty-function": "off",
|
|
59
|
+
"@typescript-eslint/no-empty-function": [
|
|
60
|
+
"error",
|
|
61
|
+
{ allow: ["constructors"] },
|
|
62
|
+
],
|
|
63
|
+
|
|
64
|
+
// A lot of 3rd party libraries still don't support esm
|
|
65
|
+
// and trying to force this right now just isn't feasible.
|
|
66
|
+
"@typescript-eslint/no-var-requires": "off",
|
|
67
|
+
"@typescript-eslint/no-require-imports": "off",
|
|
68
|
+
|
|
69
|
+
// I want aliasing support.
|
|
70
|
+
"@typescript-eslint/no-empty-object-type": "off",
|
|
71
|
+
"@typescript-eslint/no-empty-interface": "off",
|
|
72
|
+
|
|
73
|
+
// You will need unsafe declaration merging if you are doing anything
|
|
74
|
+
// with decorators as what often happens is that TypeScript cannot infer
|
|
75
|
+
// the output type of a decorator. So this has to be on to deal with
|
|
76
|
+
// TypeScripts shortcoming in this department. See
|
|
77
|
+
// https://github.com/microsoft/TypeScript/issues/4881 for more information.
|
|
78
|
+
"@typescript-eslint/no-unsafe-declaration-merging": "off",
|
|
79
|
+
|
|
80
|
+
// I can technically agree with this, but where this comes in
|
|
81
|
+
// handy is unit testing and I value that, so I want support
|
|
82
|
+
// to make the assumption that I know what I'm doing when
|
|
83
|
+
// I make a non-null assertion.
|
|
84
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
85
|
+
|
|
86
|
+
// This is actually fine, but this is broken in typescript eslint 8.14.x.
|
|
87
|
+
// See https://github.com/typescript-eslint/typescript-eslint/issues/10353
|
|
88
|
+
// for the bug.
|
|
89
|
+
"@typescript-eslint/no-unused-expressions": [
|
|
90
|
+
"error",
|
|
91
|
+
{
|
|
92
|
+
allowShortCircuit: false,
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
files: filesTest(...ExtTs, ...ExtTsx),
|
|
99
|
+
rules: {
|
|
100
|
+
// This is fine in non tests, but in tests, it prevents the
|
|
101
|
+
// use of toHaveBeenCalled matchers, so it has to be turned off.
|
|
102
|
+
"@typescript-eslint/unbound-method": "off",
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
]);
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JavaScript specific extensions.
|
|
3
|
+
*/
|
|
4
|
+
export const ExtJs = ["js", "cjs", "mjs"];
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* TypeScript specific extensions.
|
|
8
|
+
*/
|
|
9
|
+
export const ExtTs = ["ts", "mts", "cts"];
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* JSX (React) specific extensions.
|
|
13
|
+
*/
|
|
14
|
+
export const ExtJsx = ["jsx", "mjsx", "cjsx"];
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* TSX (React) specific extensions.
|
|
18
|
+
*/
|
|
19
|
+
export const ExtTsx = ["tsx", "mtsx", "ctsx"];
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A combination of all the JavaScript language based extensions.
|
|
23
|
+
*/
|
|
24
|
+
export const ExtEs = [...ExtJs, ...ExtJsx, ...ExtTs, ...ExtTsx];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* CSS specific extensions
|
|
28
|
+
*/
|
|
29
|
+
export const ExtCss = ["css"];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* HTML specific extensions
|
|
33
|
+
*/
|
|
34
|
+
export const ExtHtml = ["html", "htm"];
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Markdown specific extensions
|
|
38
|
+
*/
|
|
39
|
+
export const ExtMd = ["md"];
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Json specific extensions
|
|
43
|
+
*/
|
|
44
|
+
export const ExtJson = ["json", "jsonc", "json5"];
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Yaml specific extensions
|
|
48
|
+
*/
|
|
49
|
+
export const ExtYaml = ["yml", "yaml"];
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Generates the file patterns for the given extensions.
|
|
53
|
+
*
|
|
54
|
+
* @param extensions -
|
|
55
|
+
* The extensions to generate the file patterns for.
|
|
56
|
+
*
|
|
57
|
+
* @returns
|
|
58
|
+
* A glob pattern for each extension string provided.
|
|
59
|
+
*/
|
|
60
|
+
export function files(...extensions) {
|
|
61
|
+
return extensions.map((ext) => `**/*.${ext}`);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Generates the test file patterns for given extensions.
|
|
66
|
+
*
|
|
67
|
+
* @param extensions -
|
|
68
|
+
* The extensions to generate the test file patterns for.
|
|
69
|
+
*
|
|
70
|
+
* @returns
|
|
71
|
+
* A glob pattern for test files for each extension string provided.
|
|
72
|
+
*/
|
|
73
|
+
export function filesTest(...extensions) {
|
|
74
|
+
return extensions.flatMap((ext) => [`**/*.test.${ext}`, `**/*.spec.${ext}`]);
|
|
75
|
+
}
|
package/lib/index.d.mts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Config } from "eslint/config";
|
|
2
|
+
|
|
3
|
+
export const environments: {
|
|
4
|
+
browser: Config[];
|
|
5
|
+
node: Config[];
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const html: Config[];
|
|
9
|
+
export const ignores: Config[];
|
|
10
|
+
export const javascript: Config[];
|
|
11
|
+
export const json: Config[];
|
|
12
|
+
export const markdown: Config[];
|
|
13
|
+
export const prettier: Config[];
|
|
14
|
+
export const react: Config[];
|
|
15
|
+
export const recommended: Config[];
|
|
16
|
+
export const spelling: Config[];
|
|
17
|
+
export const styles: Config[];
|
|
18
|
+
export const test: Config[];
|
|
19
|
+
export const typescript: Config[];
|
|
20
|
+
export const yaml: Config[];
|
package/lib/index.mjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./configs/environments.mjs";
|
|
2
|
+
export * from "./configs/html.mjs";
|
|
3
|
+
export * from "./configs/ignores.mjs";
|
|
4
|
+
export * from "./configs/javascript.mjs";
|
|
5
|
+
export * from "./configs/json.mjs";
|
|
6
|
+
export * from "./configs/markdown.mjs";
|
|
7
|
+
export * from "./configs/prettier.mjs";
|
|
8
|
+
export * from "./configs/react.mjs";
|
|
9
|
+
export * from "./configs/recommended.mjs";
|
|
10
|
+
export * from "./configs/spelling.mjs";
|
|
11
|
+
export * from "./configs/styles.mjs";
|
|
12
|
+
export * from "./configs/test.mjs";
|
|
13
|
+
export * from "./configs/typescript.mjs";
|
|
14
|
+
export * from "./configs/yaml.mjs";
|
package/package.json
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zthun/janitor-eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.0.0",
|
|
4
4
|
"description": "A shared configuration for eslint for @zthun scoped projects.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
7
7
|
"eslint-config"
|
|
8
8
|
],
|
|
9
9
|
"type": "module",
|
|
10
|
-
"types": "./
|
|
11
|
-
"
|
|
12
|
-
"module": "./dist/index.js",
|
|
10
|
+
"types": "./lib/index.d.mts",
|
|
11
|
+
"module": "./lib/index.mjs",
|
|
13
12
|
"exports": {
|
|
14
|
-
"types": "./
|
|
15
|
-
"
|
|
16
|
-
"import": "./dist/index.js"
|
|
17
|
-
},
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "vite build"
|
|
13
|
+
"types": "./lib/index.d.mts",
|
|
14
|
+
"import": "./lib/index.mjs"
|
|
20
15
|
},
|
|
21
16
|
"license": "MIT",
|
|
22
17
|
"repository": {
|
|
@@ -25,28 +20,38 @@
|
|
|
25
20
|
"directory": "packages/janitor-eslint-config"
|
|
26
21
|
},
|
|
27
22
|
"files": [
|
|
28
|
-
"
|
|
23
|
+
"lib"
|
|
29
24
|
],
|
|
30
25
|
"dependencies": {
|
|
31
|
-
"@eslint
|
|
26
|
+
"@cspell/eslint-plugin": "^9.7.0",
|
|
27
|
+
"@eslint/css": "^1.1.0",
|
|
28
|
+
"@eslint/js": "^9.39.4",
|
|
29
|
+
"@eslint/json": "^1.2.0",
|
|
30
|
+
"@eslint/markdown": "^8.0.1",
|
|
31
|
+
"@html-eslint/eslint-plugin": "^0.58.1",
|
|
32
|
+
"@vitest/eslint-plugin": "^1.6.14",
|
|
32
33
|
"eslint-config-prettier": "^10.1.8",
|
|
33
34
|
"eslint-plugin-import": "^2.32.0",
|
|
34
35
|
"eslint-plugin-prettier": "^5.5.5",
|
|
35
36
|
"eslint-plugin-react": "^7.37.5",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
37
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
38
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
39
|
+
"eslint-plugin-unused-imports": "^4.4.1",
|
|
40
|
+
"eslint-plugin-yml": "^3.3.1",
|
|
41
|
+
"globals": "^17.4.0",
|
|
42
|
+
"typescript-eslint": "^8.58.0"
|
|
38
43
|
},
|
|
39
44
|
"devDependencies": {
|
|
40
|
-
"@zthun/janitor-build-config": "^
|
|
41
|
-
"eslint": "^9.39.
|
|
45
|
+
"@zthun/janitor-build-config": "^20.0.0",
|
|
46
|
+
"eslint": "^9.39.4",
|
|
42
47
|
"prettier": "^3.8.1",
|
|
43
48
|
"typescript": "~5.9.3",
|
|
44
|
-
"vite": "^
|
|
49
|
+
"vite": "^8.0.3"
|
|
45
50
|
},
|
|
46
51
|
"peerDependencies": {
|
|
47
|
-
"eslint": "
|
|
48
|
-
"prettier": "
|
|
49
|
-
"react": ">=18
|
|
52
|
+
"eslint": ">=9",
|
|
53
|
+
"prettier": ">=3",
|
|
54
|
+
"react": ">=18 <20",
|
|
50
55
|
"typescript": "^5.0.0"
|
|
51
56
|
},
|
|
52
57
|
"peerDependenciesMeta": {
|
|
@@ -58,5 +63,5 @@
|
|
|
58
63
|
"access": "public"
|
|
59
64
|
},
|
|
60
65
|
"author": "Anthony Bonta",
|
|
61
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "301c78d6aeace701c8ad4c9605b94afacad33955"
|
|
62
67
|
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Linter } from 'eslint';
|
|
2
|
-
export declare const environments: {
|
|
3
|
-
browser: Linter.Config<import('@eslint/core', { with: { "resolution-mode": "require" } }).RulesConfig>[];
|
|
4
|
-
node: Linter.Config<import('@eslint/core', { with: { "resolution-mode": "require" } }).RulesConfig>[];
|
|
5
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const prettier: import("eslint").Linter.Config<import('@eslint/core', { with: { "resolution-mode": "require" } }).RulesConfig>[];
|
package/dist/configs/react.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const recommended: import("eslint").Linter.Config<import('@eslint/core', { with: { "resolution-mode": "require" } }).RulesConfig>[];
|
package/dist/index.cjs
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
|
|
5
|
-
const globals = require('globals');
|
|
6
|
-
const _import = require('eslint-plugin-import');
|
|
7
|
-
const js = require('@eslint/js');
|
|
8
|
-
const pretty = require('eslint-plugin-prettier/recommended');
|
|
9
|
-
const _react = require('eslint-plugin-react');
|
|
10
|
-
const ts = require('typescript-eslint');
|
|
11
|
-
|
|
12
|
-
function environment(environment) {
|
|
13
|
-
return {
|
|
14
|
-
languageOptions: {
|
|
15
|
-
globals: {
|
|
16
|
-
...environment
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
const environments = {
|
|
22
|
-
browser: [
|
|
23
|
-
environment(globals.browser)
|
|
24
|
-
],
|
|
25
|
-
node: [
|
|
26
|
-
environment(globals.node),
|
|
27
|
-
environment(globals.nodeBuiltin)
|
|
28
|
-
]
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const imports = [
|
|
32
|
-
_import.flatConfigs.recommended,
|
|
33
|
-
{
|
|
34
|
-
rules: {
|
|
35
|
-
// This lint error is the main reason to use import as we want to make
|
|
36
|
-
// sure we've installed our dependencies correctly.
|
|
37
|
-
"import/no-extraneous-dependencies": "error",
|
|
38
|
-
// These are straight up broken with Typescript when you need to work with
|
|
39
|
-
// mts files that must have the file extension present. These can be fixed
|
|
40
|
-
// using resolves, but it's such a pain and it's just not worth the hassle
|
|
41
|
-
// for basic linting support. The no-extraneous-dependencies is really
|
|
42
|
-
// the recommended config we want, so these being forced off are fine.
|
|
43
|
-
"import/named": "off",
|
|
44
|
-
"import/no-unresolved": "off"
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
];
|
|
48
|
-
|
|
49
|
-
const javascript = [
|
|
50
|
-
js.configs.recommended,
|
|
51
|
-
{
|
|
52
|
-
rules: {
|
|
53
|
-
// We want to support == null so we get a good check for undefined
|
|
54
|
-
// or null
|
|
55
|
-
eqeqeq: [
|
|
56
|
-
"error",
|
|
57
|
-
"smart"
|
|
58
|
-
],
|
|
59
|
-
// Would be fine, but there's a bug in this where you have a function with
|
|
60
|
-
// access arguments. Those constructors are often empty - so we want to let
|
|
61
|
-
// a part of this one through.
|
|
62
|
-
"no-empty-function": "off"
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
];
|
|
66
|
-
|
|
67
|
-
const prettier = [
|
|
68
|
-
pretty
|
|
69
|
-
];
|
|
70
|
-
|
|
71
|
-
const react = [
|
|
72
|
-
{
|
|
73
|
-
files: [
|
|
74
|
-
"**/*.{js,cjs,mjs,ts,mts,jsx,tsx}"
|
|
75
|
-
],
|
|
76
|
-
plugins: {
|
|
77
|
-
react: _react
|
|
78
|
-
},
|
|
79
|
-
languageOptions: {
|
|
80
|
-
parserOptions: {
|
|
81
|
-
ecmaFeatures: {
|
|
82
|
-
jsx: true
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
settings: {
|
|
87
|
-
react: {
|
|
88
|
-
version: "detect"
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
rules: {
|
|
92
|
-
// This one is not needed any longer as TypeScript jsx option
|
|
93
|
-
// should be set to react-jsx. You will need to turn this on
|
|
94
|
-
// manually if it is set to the legacy react setting. See
|
|
95
|
-
// https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#whats-different-in-the-new-transform
|
|
96
|
-
"react/react-in-jsx-scope": "off"
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
];
|
|
100
|
-
|
|
101
|
-
const typescript = [
|
|
102
|
-
...ts.configs.recommended,
|
|
103
|
-
{
|
|
104
|
-
rules: {
|
|
105
|
-
// We want to be able to use a single build system for most things.
|
|
106
|
-
// Ideally, we can use vite to build all project types so we don't
|
|
107
|
-
// have 4 different build systems across different projects. Thus
|
|
108
|
-
// we need to make sure that swc, esbuild, and tsc are supported.
|
|
109
|
-
// Forcing type imports ensures this.
|
|
110
|
-
"@typescript-eslint/consistent-type-imports": [
|
|
111
|
-
"error",
|
|
112
|
-
{
|
|
113
|
-
prefer: "type-imports"
|
|
114
|
-
}
|
|
115
|
-
],
|
|
116
|
-
// There are times when any and legacy namespaces makes sense.
|
|
117
|
-
// If you use any kind of decorator library, you will almost
|
|
118
|
-
// be required to use any at some point. Forcing a non use of them
|
|
119
|
-
// means you're spending a bunch of time play type gymnastics and to
|
|
120
|
-
// hell with that.
|
|
121
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
122
|
-
"@typescript-eslint/no-namespace": "off",
|
|
123
|
-
// Would be fine, but there's a bug in this where you have a function with
|
|
124
|
-
// access arguments. Those constructors are often empty - so we want to let
|
|
125
|
-
// a part of this one through.
|
|
126
|
-
"no-empty-function": "off",
|
|
127
|
-
"@typescript-eslint/no-empty-function": [
|
|
128
|
-
"error",
|
|
129
|
-
{
|
|
130
|
-
allow: [
|
|
131
|
-
"constructors"
|
|
132
|
-
]
|
|
133
|
-
}
|
|
134
|
-
],
|
|
135
|
-
// A lot of 3rd party libraries still don't support esm
|
|
136
|
-
// and trying to force this right now just isn't feasible.
|
|
137
|
-
"@typescript-eslint/no-var-requires": "off",
|
|
138
|
-
"@typescript-eslint/no-require-imports": "off",
|
|
139
|
-
// I want aliasing support.
|
|
140
|
-
"@typescript-eslint/no-empty-object-type": "off",
|
|
141
|
-
"@typescript-eslint/no-empty-interface": "off",
|
|
142
|
-
// You will need unsafe declaration merging if you are doing anything
|
|
143
|
-
// with decorators as what often happens is that TypeScript cannot infer
|
|
144
|
-
// the output type of a decorator. So this has to be on to deal with
|
|
145
|
-
// TypeScripts shortcoming in this department. See
|
|
146
|
-
// https://github.com/microsoft/TypeScript/issues/4881 for more information.
|
|
147
|
-
"@typescript-eslint/no-unsafe-declaration-merging": "off",
|
|
148
|
-
// I can technically agree with this, but where this comes in
|
|
149
|
-
// handy is unit testing and I value that, so I want support
|
|
150
|
-
// to make the assumption that I know what I'm doing when
|
|
151
|
-
// I make a non-null assertion.
|
|
152
|
-
"@typescript-eslint/no-non-null-assertion": "off",
|
|
153
|
-
// This is actually fine, but this is broken in typescript eslint 8.14.x.
|
|
154
|
-
// See https://github.com/typescript-eslint/typescript-eslint/issues/10353
|
|
155
|
-
// for the bug.
|
|
156
|
-
"no-unused-expressions": "off",
|
|
157
|
-
"@typescript-eslint/no-unused-expressions": [
|
|
158
|
-
"error",
|
|
159
|
-
{
|
|
160
|
-
allowShortCircuit: false
|
|
161
|
-
}
|
|
162
|
-
]
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
];
|
|
166
|
-
|
|
167
|
-
const recommended = [
|
|
168
|
-
...javascript,
|
|
169
|
-
...typescript,
|
|
170
|
-
...imports,
|
|
171
|
-
...prettier
|
|
172
|
-
];
|
|
173
|
-
|
|
174
|
-
exports.environments = environments;
|
|
175
|
-
exports.imports = imports;
|
|
176
|
-
exports.javascript = javascript;
|
|
177
|
-
exports.prettier = prettier;
|
|
178
|
-
exports.react = react;
|
|
179
|
-
exports.recommended = recommended;
|
|
180
|
-
exports.typescript = typescript;
|
|
181
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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: Linter.Config[] = [\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","languageOptions","globals","environments","browser","node","nodeBuiltin","imports","_import","flatConfigs","recommended","rules","javascript","js","configs","eqeqeq","prettier","pretty","react","files","plugins","_react","parserOptions","ecmaFeatures","jsx","settings","version","typescript","ts","prefer","allow","allowShortCircuit"],"mappings":";;;;;;;;;;;AAGA,SAASA,YAAYA,WAAmB,EAAA;IACtC,OAAO;QACLC,eAAAA,EAAiB;YACfC,OAAAA,EAAS;AACP,gBAAA,GAAGF;AACL;AACF;AACF,KAAA;AACF;MAEaG,YAAAA,GAAe;IAC1BC,OAAAA,EAAS;AAACJ,QAAAA,WAAAA,CAAYE,QAAQE,OAAO;AAAE,KAAA;IACvCC,IAAAA,EAAM;AAACL,QAAAA,WAAAA,CAAYE,QAAQG,IAAI,CAAA;AAAGL,QAAAA,WAAAA,CAAYE,QAAQI,WAAW;AAAE;AACrE;;MCbaC,OAAAA,GAA2B;IACtCC,OAAAA,CAAQC,WAAW,CAACC,WAAW;AAC/B,IAAA;QACEC,KAAAA,EAAO;;;YAGL,mCAAA,EAAqC,OAAA;;;;;;YAOrC,cAAA,EAAgB,KAAA;YAChB,sBAAA,EAAwB;AAC1B;AACF;;;MChBWC,UAAAA,GAA8B;IACzCC,EAAAA,CAAGC,OAAO,CAACJ,WAAW;AACtB,IAAA;QACEC,KAAAA,EAAO;;;YAGLI,MAAAA,EAAQ;AAAC,gBAAA,OAAA;AAAS,gBAAA;AAAQ,aAAA;;;;YAI1B,mBAAA,EAAqB;AACvB;AACF;;;MCbWC,QAAAA,GAAW;AAACC,IAAAA;;;MCCZC,KAAAA,GAAyB;AACpC,IAAA;QACEC,KAAAA,EAAO;AAAC,YAAA;AAAmC,SAAA;QAC3CC,OAAAA,EAAS;YACPF,KAAAA,EAAOG;AACT,SAAA;QACApB,eAAAA,EAAiB;YACfqB,aAAAA,EAAe;gBACbC,YAAAA,EAAc;oBACZC,GAAAA,EAAK;AACP;AACF;AACF,SAAA;QACAC,QAAAA,EAAU;YACRP,KAAAA,EAAO;gBACLQ,OAAAA,EAAS;AACX;AACF,SAAA;QACAf,KAAAA,EAAO;;;;;YAKL,0BAAA,EAA4B;AAC9B;AACF;;;MCzBWgB,UAAAA,GAA8B;OACtCC,EAAAA,CAAGd,OAAO,CAACJ,WAAW;AACzB,IAAA;QACEC,KAAAA,EAAO;;;;;;YAML,4CAAA,EAA8C;AAC5C,gBAAA,OAAA;AACA,gBAAA;oBAAEkB,MAAAA,EAAQ;AAAe;AAC1B,aAAA;;;;;;YAMD,oCAAA,EAAsC,KAAA;YACtC,iCAAA,EAAmC,KAAA;;;;YAKnC,mBAAA,EAAqB,KAAA;YACrB,sCAAA,EAAwC;AACtC,gBAAA,OAAA;AACA,gBAAA;oBAAEC,KAAAA,EAAO;AAAC,wBAAA;AAAe;AAAC;AAC3B,aAAA;;;YAID,oCAAA,EAAsC,KAAA;YACtC,uCAAA,EAAyC,KAAA;;YAGzC,yCAAA,EAA2C,KAAA;YAC3C,uCAAA,EAAyC,KAAA;;;;;;YAOzC,kDAAA,EAAoD,KAAA;;;;;YAMpD,0CAAA,EAA4C,KAAA;;;;YAK5C,uBAAA,EAAyB,KAAA;YACzB,0CAAA,EAA4C;AAC1C,gBAAA,OAAA;AACA,gBAAA;oBACEC,iBAAAA,EAAmB;AACrB;AACD;AACH;AACF;;;MC7DWrB,WAAAA,GAAc;AACtBE,IAAAA,GAAAA,UAAAA;AACAe,IAAAA,GAAAA,UAAAA;AACApB,IAAAA,GAAAA,OAAAA;AACAS,IAAAA,GAAAA;;;;;;;;;;;"}
|
package/dist/index.d.mts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from './configs/environments.mjs';
|
|
2
|
-
export * from './configs/imports.mjs';
|
|
3
|
-
export * from './configs/javascript.mjs';
|
|
4
|
-
export * from './configs/prettier.mjs';
|
|
5
|
-
export * from './configs/react.mjs';
|
|
6
|
-
export * from './configs/recommended.mjs';
|
|
7
|
-
export * from './configs/typescript.mjs';
|
package/dist/index.js
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
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
|
-
|
|
8
|
-
function environment(environment) {
|
|
9
|
-
return {
|
|
10
|
-
languageOptions: {
|
|
11
|
-
globals: {
|
|
12
|
-
...environment
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
const environments = {
|
|
18
|
-
browser: [
|
|
19
|
-
environment(globals.browser)
|
|
20
|
-
],
|
|
21
|
-
node: [
|
|
22
|
-
environment(globals.node),
|
|
23
|
-
environment(globals.nodeBuiltin)
|
|
24
|
-
]
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const imports = [
|
|
28
|
-
_import.flatConfigs.recommended,
|
|
29
|
-
{
|
|
30
|
-
rules: {
|
|
31
|
-
// This lint error is the main reason to use import as we want to make
|
|
32
|
-
// sure we've installed our dependencies correctly.
|
|
33
|
-
"import/no-extraneous-dependencies": "error",
|
|
34
|
-
// These are straight up broken with Typescript when you need to work with
|
|
35
|
-
// mts files that must have the file extension present. These can be fixed
|
|
36
|
-
// using resolves, but it's such a pain and it's just not worth the hassle
|
|
37
|
-
// for basic linting support. The no-extraneous-dependencies is really
|
|
38
|
-
// the recommended config we want, so these being forced off are fine.
|
|
39
|
-
"import/named": "off",
|
|
40
|
-
"import/no-unresolved": "off"
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
];
|
|
44
|
-
|
|
45
|
-
const javascript = [
|
|
46
|
-
js.configs.recommended,
|
|
47
|
-
{
|
|
48
|
-
rules: {
|
|
49
|
-
// We want to support == null so we get a good check for undefined
|
|
50
|
-
// or null
|
|
51
|
-
eqeqeq: [
|
|
52
|
-
"error",
|
|
53
|
-
"smart"
|
|
54
|
-
],
|
|
55
|
-
// Would be fine, but there's a bug in this where you have a function with
|
|
56
|
-
// access arguments. Those constructors are often empty - so we want to let
|
|
57
|
-
// a part of this one through.
|
|
58
|
-
"no-empty-function": "off"
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
];
|
|
62
|
-
|
|
63
|
-
const prettier = [
|
|
64
|
-
pretty
|
|
65
|
-
];
|
|
66
|
-
|
|
67
|
-
const react = [
|
|
68
|
-
{
|
|
69
|
-
files: [
|
|
70
|
-
"**/*.{js,cjs,mjs,ts,mts,jsx,tsx}"
|
|
71
|
-
],
|
|
72
|
-
plugins: {
|
|
73
|
-
react: _react
|
|
74
|
-
},
|
|
75
|
-
languageOptions: {
|
|
76
|
-
parserOptions: {
|
|
77
|
-
ecmaFeatures: {
|
|
78
|
-
jsx: true
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
settings: {
|
|
83
|
-
react: {
|
|
84
|
-
version: "detect"
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
rules: {
|
|
88
|
-
// This one is not needed any longer as TypeScript jsx option
|
|
89
|
-
// should be set to react-jsx. You will need to turn this on
|
|
90
|
-
// manually if it is set to the legacy react setting. See
|
|
91
|
-
// https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#whats-different-in-the-new-transform
|
|
92
|
-
"react/react-in-jsx-scope": "off"
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
];
|
|
96
|
-
|
|
97
|
-
const typescript = [
|
|
98
|
-
...ts.configs.recommended,
|
|
99
|
-
{
|
|
100
|
-
rules: {
|
|
101
|
-
// We want to be able to use a single build system for most things.
|
|
102
|
-
// Ideally, we can use vite to build all project types so we don't
|
|
103
|
-
// have 4 different build systems across different projects. Thus
|
|
104
|
-
// we need to make sure that swc, esbuild, and tsc are supported.
|
|
105
|
-
// Forcing type imports ensures this.
|
|
106
|
-
"@typescript-eslint/consistent-type-imports": [
|
|
107
|
-
"error",
|
|
108
|
-
{
|
|
109
|
-
prefer: "type-imports"
|
|
110
|
-
}
|
|
111
|
-
],
|
|
112
|
-
// There are times when any and legacy namespaces makes sense.
|
|
113
|
-
// If you use any kind of decorator library, you will almost
|
|
114
|
-
// be required to use any at some point. Forcing a non use of them
|
|
115
|
-
// means you're spending a bunch of time play type gymnastics and to
|
|
116
|
-
// hell with that.
|
|
117
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
118
|
-
"@typescript-eslint/no-namespace": "off",
|
|
119
|
-
// Would be fine, but there's a bug in this where you have a function with
|
|
120
|
-
// access arguments. Those constructors are often empty - so we want to let
|
|
121
|
-
// a part of this one through.
|
|
122
|
-
"no-empty-function": "off",
|
|
123
|
-
"@typescript-eslint/no-empty-function": [
|
|
124
|
-
"error",
|
|
125
|
-
{
|
|
126
|
-
allow: [
|
|
127
|
-
"constructors"
|
|
128
|
-
]
|
|
129
|
-
}
|
|
130
|
-
],
|
|
131
|
-
// A lot of 3rd party libraries still don't support esm
|
|
132
|
-
// and trying to force this right now just isn't feasible.
|
|
133
|
-
"@typescript-eslint/no-var-requires": "off",
|
|
134
|
-
"@typescript-eslint/no-require-imports": "off",
|
|
135
|
-
// I want aliasing support.
|
|
136
|
-
"@typescript-eslint/no-empty-object-type": "off",
|
|
137
|
-
"@typescript-eslint/no-empty-interface": "off",
|
|
138
|
-
// You will need unsafe declaration merging if you are doing anything
|
|
139
|
-
// with decorators as what often happens is that TypeScript cannot infer
|
|
140
|
-
// the output type of a decorator. So this has to be on to deal with
|
|
141
|
-
// TypeScripts shortcoming in this department. See
|
|
142
|
-
// https://github.com/microsoft/TypeScript/issues/4881 for more information.
|
|
143
|
-
"@typescript-eslint/no-unsafe-declaration-merging": "off",
|
|
144
|
-
// I can technically agree with this, but where this comes in
|
|
145
|
-
// handy is unit testing and I value that, so I want support
|
|
146
|
-
// to make the assumption that I know what I'm doing when
|
|
147
|
-
// I make a non-null assertion.
|
|
148
|
-
"@typescript-eslint/no-non-null-assertion": "off",
|
|
149
|
-
// This is actually fine, but this is broken in typescript eslint 8.14.x.
|
|
150
|
-
// See https://github.com/typescript-eslint/typescript-eslint/issues/10353
|
|
151
|
-
// for the bug.
|
|
152
|
-
"no-unused-expressions": "off",
|
|
153
|
-
"@typescript-eslint/no-unused-expressions": [
|
|
154
|
-
"error",
|
|
155
|
-
{
|
|
156
|
-
allowShortCircuit: false
|
|
157
|
-
}
|
|
158
|
-
]
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
];
|
|
162
|
-
|
|
163
|
-
const recommended = [
|
|
164
|
-
...javascript,
|
|
165
|
-
...typescript,
|
|
166
|
-
...imports,
|
|
167
|
-
...prettier
|
|
168
|
-
];
|
|
169
|
-
|
|
170
|
-
export { environments, imports, javascript, prettier, react, recommended, typescript };
|
|
171
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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: Linter.Config[] = [\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","languageOptions","globals","environments","browser","node","nodeBuiltin","imports","_import","flatConfigs","recommended","rules","javascript","js","configs","eqeqeq","prettier","pretty","react","files","plugins","_react","parserOptions","ecmaFeatures","jsx","settings","version","typescript","ts","prefer","allow","allowShortCircuit"],"mappings":";;;;;;;AAGA,SAASA,YAAYA,WAAmB,EAAA;IACtC,OAAO;QACLC,eAAAA,EAAiB;YACfC,OAAAA,EAAS;AACP,gBAAA,GAAGF;AACL;AACF;AACF,KAAA;AACF;MAEaG,YAAAA,GAAe;IAC1BC,OAAAA,EAAS;AAACJ,QAAAA,WAAAA,CAAYE,QAAQE,OAAO;AAAE,KAAA;IACvCC,IAAAA,EAAM;AAACL,QAAAA,WAAAA,CAAYE,QAAQG,IAAI,CAAA;AAAGL,QAAAA,WAAAA,CAAYE,QAAQI,WAAW;AAAE;AACrE;;MCbaC,OAAAA,GAA2B;IACtCC,OAAAA,CAAQC,WAAW,CAACC,WAAW;AAC/B,IAAA;QACEC,KAAAA,EAAO;;;YAGL,mCAAA,EAAqC,OAAA;;;;;;YAOrC,cAAA,EAAgB,KAAA;YAChB,sBAAA,EAAwB;AAC1B;AACF;;;MChBWC,UAAAA,GAA8B;IACzCC,EAAAA,CAAGC,OAAO,CAACJ,WAAW;AACtB,IAAA;QACEC,KAAAA,EAAO;;;YAGLI,MAAAA,EAAQ;AAAC,gBAAA,OAAA;AAAS,gBAAA;AAAQ,aAAA;;;;YAI1B,mBAAA,EAAqB;AACvB;AACF;;;MCbWC,QAAAA,GAAW;AAACC,IAAAA;;;MCCZC,KAAAA,GAAyB;AACpC,IAAA;QACEC,KAAAA,EAAO;AAAC,YAAA;AAAmC,SAAA;QAC3CC,OAAAA,EAAS;YACPF,KAAAA,EAAOG;AACT,SAAA;QACApB,eAAAA,EAAiB;YACfqB,aAAAA,EAAe;gBACbC,YAAAA,EAAc;oBACZC,GAAAA,EAAK;AACP;AACF;AACF,SAAA;QACAC,QAAAA,EAAU;YACRP,KAAAA,EAAO;gBACLQ,OAAAA,EAAS;AACX;AACF,SAAA;QACAf,KAAAA,EAAO;;;;;YAKL,0BAAA,EAA4B;AAC9B;AACF;;;MCzBWgB,UAAAA,GAA8B;OACtCC,EAAAA,CAAGd,OAAO,CAACJ,WAAW;AACzB,IAAA;QACEC,KAAAA,EAAO;;;;;;YAML,4CAAA,EAA8C;AAC5C,gBAAA,OAAA;AACA,gBAAA;oBAAEkB,MAAAA,EAAQ;AAAe;AAC1B,aAAA;;;;;;YAMD,oCAAA,EAAsC,KAAA;YACtC,iCAAA,EAAmC,KAAA;;;;YAKnC,mBAAA,EAAqB,KAAA;YACrB,sCAAA,EAAwC;AACtC,gBAAA,OAAA;AACA,gBAAA;oBAAEC,KAAAA,EAAO;AAAC,wBAAA;AAAe;AAAC;AAC3B,aAAA;;;YAID,oCAAA,EAAsC,KAAA;YACtC,uCAAA,EAAyC,KAAA;;YAGzC,yCAAA,EAA2C,KAAA;YAC3C,uCAAA,EAAyC,KAAA;;;;;;YAOzC,kDAAA,EAAoD,KAAA;;;;;YAMpD,0CAAA,EAA4C,KAAA;;;;YAK5C,uBAAA,EAAyB,KAAA;YACzB,0CAAA,EAA4C;AAC1C,gBAAA,OAAA;AACA,gBAAA;oBACEC,iBAAAA,EAAmB;AACrB;AACD;AACH;AACF;;;MC7DWrB,WAAAA,GAAc;AACtBE,IAAAA,GAAAA,UAAAA;AACAe,IAAAA,GAAAA,UAAAA;AACApB,IAAAA,GAAAA,OAAAA;AACAS,IAAAA,GAAAA;;;;;"}
|