@peerigon/configs 4.2.0 → 4.3.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/{types → dist}/eslint/lib/glob-patterns.d.ts +0 -1
- package/dist/eslint/lib/glob-patterns.js +11 -0
- package/{types → dist}/eslint/lib/rule-options.d.ts +0 -1
- package/dist/eslint/lib/rule-options.js +127 -0
- package/{types → dist}/eslint/presets/javascript-browser.d.ts +0 -1
- package/{eslint → dist/eslint}/presets/javascript-browser.js +4 -6
- package/{types → dist}/eslint/presets/javascript-node.d.ts +0 -1
- package/{eslint → dist/eslint}/presets/javascript-node.js +4 -6
- package/{types → dist}/eslint/presets/javascript.d.ts +0 -1
- package/{eslint → dist/eslint}/presets/javascript.js +0 -2
- package/{types → dist}/eslint/presets/typescript-node.d.ts +0 -1
- package/{eslint → dist/eslint}/presets/typescript-node.js +5 -7
- package/{types → dist}/eslint/presets/typescript-react.d.ts +0 -1
- package/{eslint → dist/eslint}/presets/typescript-react.js +6 -8
- package/{types → dist}/eslint/presets/typescript.d.ts +0 -1
- package/{eslint → dist/eslint}/presets/typescript.js +4 -6
- package/{types → dist}/eslint/rules/base.d.ts +0 -1
- package/{eslint → dist/eslint}/rules/base.js +5 -8
- package/{types → dist}/eslint/rules/browser.d.ts +0 -1
- package/{eslint → dist/eslint}/rules/browser.js +4 -6
- package/{types → dist}/eslint/rules/javascript.d.ts +0 -1
- package/dist/eslint/rules/javascript.js +151 -0
- package/{types → dist}/eslint/rules/node.d.ts +0 -1
- package/{eslint → dist/eslint}/rules/node.js +4 -6
- package/{types → dist}/eslint/rules/react.d.ts +0 -1
- package/dist/eslint/rules/react.js +166 -0
- package/{types → dist}/eslint/rules/typescript.d.ts +0 -1
- package/dist/eslint/rules/typescript.js +195 -0
- package/{types → dist}/eslint/styles/jsx-no-literals.d.ts +0 -1
- package/dist/eslint/styles/jsx-no-literals.js +29 -0
- package/{types → dist}/eslint/styles/no-default-export.d.ts +0 -1
- package/dist/eslint/styles/no-default-export.js +18 -0
- package/{types → dist}/eslint/styles/no-null.d.ts +0 -1
- package/{eslint → dist/eslint}/styles/no-null.js +4 -5
- package/{types → dist}/eslint/styles/prefer-array-shorthand.d.ts +0 -1
- package/dist/eslint/styles/prefer-array-shorthand.js +14 -0
- package/{types → dist}/eslint/styles/prefer-interface.d.ts +0 -1
- package/dist/eslint/styles/prefer-interface.js +9 -0
- package/dist/prettier/base.d.ts +8 -0
- package/dist/prettier/base.js +55 -0
- package/{types → dist}/semantic-release/base.d.ts +0 -1
- package/dist/semantic-release/base.js +40 -0
- package/{types → dist}/semantic-release/cross-publish.d.ts +4 -1
- package/dist/semantic-release/cross-publish.js +35 -0
- package/dist/typescript/base.json +43 -0
- package/dist/typescript/configs.d.ts +1 -0
- package/dist/typescript/configs.js +4 -0
- package/dist/typescript/js-lib.json +11 -0
- package/dist/typescript/lib.json +13 -0
- package/package.json +24 -74
- package/eslint/README.md +0 -119
- package/eslint/lib/glob-patterns.js +0 -11
- package/eslint/lib/rule-options.js +0 -130
- package/eslint/presets/javascript.test/eslint.config.js +0 -1
- package/eslint/presets/javascript.test/main.js +0 -62
- package/eslint/presets/javascript.test/other.js +0 -2
- package/eslint/presets/typescript-react.test/App.tsx +0 -47
- package/eslint/presets/typescript-react.test/Other.tsx +0 -5
- package/eslint/presets/typescript-react.test/eslint.config.js +0 -1
- package/eslint/presets/typescript-react.test/tsconfig.json +0 -7
- package/eslint/presets/typescript.test/eslint.config.js +0 -1
- package/eslint/presets/typescript.test/main.ts +0 -42
- package/eslint/presets/typescript.test/message.ts +0 -3
- package/eslint/presets/typescript.test/test.json +0 -1
- package/eslint/presets/typescript.test/tsconfig.json +0 -4
- package/eslint/presets/typescript.test/types.d.ts +0 -11
- package/eslint/rules/javascript.js +0 -157
- package/eslint/rules/react.js +0 -169
- package/eslint/rules/typescript.js +0 -206
- package/eslint/styles/jsx-no-literals.js +0 -31
- package/eslint/styles/jsx-no-literals.test/eslint.config.js +0 -4
- package/eslint/styles/jsx-no-literals.test/main.tsx +0 -4
- package/eslint/styles/jsx-no-literals.test/tsconfig.json +0 -7
- package/eslint/styles/no-default-export.js +0 -20
- package/eslint/styles/no-default-export.test/eslint.config.js +0 -4
- package/eslint/styles/no-default-export.test/main.ts +0 -2
- package/eslint/styles/no-default-export.test/tsconfig.json +0 -4
- package/eslint/styles/no-default-export.test/vitest.config.ts +0 -1
- package/eslint/styles/no-null.test/eslint.config.js +0 -4
- package/eslint/styles/no-null.test/main.ts +0 -2
- package/eslint/styles/no-null.test/tsconfig.json +0 -4
- package/eslint/styles/prefer-array-shorthand.js +0 -15
- package/eslint/styles/prefer-array-shorthand.test/eslint.config.js +0 -4
- package/eslint/styles/prefer-array-shorthand.test/main.ts +0 -4
- package/eslint/styles/prefer-array-shorthand.test/tsconfig.json +0 -4
- package/eslint/styles/prefer-interface.js +0 -10
- package/eslint/styles/prefer-interface.test/eslint.config.js +0 -4
- package/eslint/styles/prefer-interface.test/main.ts +0 -8
- package/eslint/styles/prefer-interface.test/tsconfig.json +0 -4
- package/eslint/types.d.ts +0 -50
- package/prettier/README.md +0 -35
- package/prettier/base.js +0 -35
- package/prettier/css.test/styles.css +0 -9
- package/semantic-release/README.md +0 -81
- package/semantic-release/base.js +0 -41
- package/semantic-release/cross-publish.js +0 -41
- package/types/eslint/lib/glob-patterns.d.ts.map +0 -1
- package/types/eslint/lib/rule-options.d.ts.map +0 -1
- package/types/eslint/presets/javascript-browser.d.ts.map +0 -1
- package/types/eslint/presets/javascript-node.d.ts.map +0 -1
- package/types/eslint/presets/javascript.d.ts.map +0 -1
- package/types/eslint/presets/javascript.test/eslint.config.d.ts +0 -2
- package/types/eslint/presets/javascript.test/eslint.config.d.ts.map +0 -1
- package/types/eslint/presets/javascript.test/main.d.ts +0 -2
- package/types/eslint/presets/javascript.test/main.d.ts.map +0 -1
- package/types/eslint/presets/javascript.test/other.d.ts +0 -3
- package/types/eslint/presets/javascript.test/other.d.ts.map +0 -1
- package/types/eslint/presets/typescript-node.d.ts.map +0 -1
- package/types/eslint/presets/typescript-react.d.ts.map +0 -1
- package/types/eslint/presets/typescript.d.ts.map +0 -1
- package/types/eslint/rules/base.d.ts.map +0 -1
- package/types/eslint/rules/browser.d.ts.map +0 -1
- package/types/eslint/rules/javascript.d.ts.map +0 -1
- package/types/eslint/rules/node.d.ts.map +0 -1
- package/types/eslint/rules/react.d.ts.map +0 -1
- package/types/eslint/rules/typescript.d.ts.map +0 -1
- package/types/eslint/styles/jsx-no-literals.d.ts.map +0 -1
- package/types/eslint/styles/no-default-export.d.ts.map +0 -1
- package/types/eslint/styles/no-default-export.test/eslint.config.d.ts +0 -3
- package/types/eslint/styles/no-default-export.test/eslint.config.d.ts.map +0 -1
- package/types/eslint/styles/no-default-export.test/main.d.ts +0 -3
- package/types/eslint/styles/no-default-export.test/main.d.ts.map +0 -1
- package/types/eslint/styles/no-default-export.test/vitest.config.d.ts +0 -3
- package/types/eslint/styles/no-default-export.test/vitest.config.d.ts.map +0 -1
- package/types/eslint/styles/no-null.d.ts.map +0 -1
- package/types/eslint/styles/no-null.test/eslint.config.d.ts +0 -3
- package/types/eslint/styles/no-null.test/eslint.config.d.ts.map +0 -1
- package/types/eslint/styles/no-null.test/main.d.ts +0 -2
- package/types/eslint/styles/no-null.test/main.d.ts.map +0 -1
- package/types/eslint/styles/prefer-array-shorthand.d.ts.map +0 -1
- package/types/eslint/styles/prefer-array-shorthand.test/eslint.config.d.ts +0 -3
- package/types/eslint/styles/prefer-array-shorthand.test/eslint.config.d.ts.map +0 -1
- package/types/eslint/styles/prefer-array-shorthand.test/main.d.ts +0 -3
- package/types/eslint/styles/prefer-array-shorthand.test/main.d.ts.map +0 -1
- package/types/eslint/styles/prefer-interface.d.ts.map +0 -1
- package/types/eslint/styles/prefer-interface.test/eslint.config.d.ts +0 -3
- package/types/eslint/styles/prefer-interface.test/eslint.config.d.ts.map +0 -1
- package/types/eslint/styles/prefer-interface.test/main.d.ts +0 -7
- package/types/eslint/styles/prefer-interface.test/main.d.ts.map +0 -1
- package/types/prettier/base.d.ts +0 -4
- package/types/prettier/base.d.ts.map +0 -1
- package/types/semantic-release/base.d.ts.map +0 -1
- package/types/semantic-release/cross-publish.d.ts.map +0 -1
- package/typescript/README.md +0 -63
- package/typescript/base.json +0 -44
- package/typescript/js-lib.json +0 -8
- package/typescript/lib.json +0 -11
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import reactPlugin2 from "@eslint-react/eslint-plugin";
|
|
2
|
+
import jsxA11yPlugin from "eslint-plugin-jsx-a11y";
|
|
3
|
+
import reactPlugin from "eslint-plugin-react";
|
|
4
|
+
import reactCompilerPlugin from "eslint-plugin-react-compiler";
|
|
5
|
+
import reactHooksPlugin from "eslint-plugin-react-hooks";
|
|
6
|
+
import reactRefreshPlugin from "eslint-plugin-react-refresh";
|
|
7
|
+
import { globPatterns } from "../lib/glob-patterns.js";
|
|
8
|
+
const files = [globPatterns.jsx, globPatterns.typescriptJsx];
|
|
9
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
10
|
+
export const react = [
|
|
11
|
+
{
|
|
12
|
+
...reactPlugin.configs.flat.recommended,
|
|
13
|
+
files,
|
|
14
|
+
languageOptions: {
|
|
15
|
+
...reactPlugin.configs.flat.recommended.languageOptions,
|
|
16
|
+
},
|
|
17
|
+
settings: {
|
|
18
|
+
react: {
|
|
19
|
+
version: "detect",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
...reactPlugin.configs.flat["jsx-runtime"],
|
|
25
|
+
files,
|
|
26
|
+
},
|
|
27
|
+
// @ts-expect-error Seems like reactPlugin2's types are broken
|
|
28
|
+
{
|
|
29
|
+
...reactPlugin2.configs.recommended,
|
|
30
|
+
files,
|
|
31
|
+
},
|
|
32
|
+
// @ts-expect-error Seems like reactPlugin2's types are broken
|
|
33
|
+
{
|
|
34
|
+
...reactPlugin2.configs["recommended-type-checked"],
|
|
35
|
+
files,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
...jsxA11yPlugin.flatConfigs.recommended,
|
|
39
|
+
files,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
...jsxA11yPlugin.flatConfigs.strict,
|
|
43
|
+
files,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
files,
|
|
47
|
+
plugins: {
|
|
48
|
+
"react-refresh": reactRefreshPlugin,
|
|
49
|
+
},
|
|
50
|
+
rules: {
|
|
51
|
+
"react-refresh/only-export-components": [
|
|
52
|
+
"warn",
|
|
53
|
+
{
|
|
54
|
+
allowConstantExport: true,
|
|
55
|
+
allowExportNames: [
|
|
56
|
+
// Next.js
|
|
57
|
+
"getServerSideProps",
|
|
58
|
+
// Remix
|
|
59
|
+
"meta",
|
|
60
|
+
"links",
|
|
61
|
+
"headers",
|
|
62
|
+
"loader",
|
|
63
|
+
"action",
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
// There's currently no official recommended flat config for react-hooks.
|
|
70
|
+
// TODO: Use recommended config when it's available.
|
|
71
|
+
{
|
|
72
|
+
files,
|
|
73
|
+
plugins: {
|
|
74
|
+
"react-hooks": reactHooksPlugin,
|
|
75
|
+
},
|
|
76
|
+
rules: {
|
|
77
|
+
"react-hooks/rules-of-hooks": "error",
|
|
78
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
// There's currently no official recommended flat config for react-compiler.
|
|
82
|
+
// TODO: Use recommended config when it's available.
|
|
83
|
+
{
|
|
84
|
+
files,
|
|
85
|
+
plugins: {
|
|
86
|
+
"react-compiler": reactCompilerPlugin,
|
|
87
|
+
},
|
|
88
|
+
rules: {
|
|
89
|
+
"react-compiler/react-compiler": "error",
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
files,
|
|
94
|
+
rules: {
|
|
95
|
+
"react/button-has-type": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/boolean-prop-naming.md
|
|
96
|
+
"react/default-props-match-prop-types": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/default-props-match-prop-types.md
|
|
97
|
+
"react/display-name": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/display-name.md
|
|
98
|
+
"react/forbid-foreign-prop-types": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-foreign-prop-types.md
|
|
99
|
+
"react/forbid-prop-types": [
|
|
100
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-prop-types.md
|
|
101
|
+
"warn",
|
|
102
|
+
{
|
|
103
|
+
checkChildContextTypes: true,
|
|
104
|
+
checkContextTypes: true,
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
// Superseded by @eslint-react/naming-convention/use-state because it handles
|
|
108
|
+
// [, setState] = useState() as well.
|
|
109
|
+
"react/hook-use-state": ["off", { allowDestructuredState: true }], // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/hook-use-state.md
|
|
110
|
+
"react/iframe-missing-sandbox": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/iframe-missing-sandbox.md
|
|
111
|
+
"react/jsx-boolean-value": ["warn", "never"], // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
|
|
112
|
+
"react/jsx-curly-brace-presence": ["warn", "never"], // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
|
|
113
|
+
"react/jsx-filename-extension": [
|
|
114
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
|
|
115
|
+
"warn",
|
|
116
|
+
{
|
|
117
|
+
extensions: [".jsx", ".tsx"],
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
"react/jsx-handler-names": [
|
|
121
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
|
|
122
|
+
"warn",
|
|
123
|
+
{
|
|
124
|
+
eventHandlerPrefix: "handle",
|
|
125
|
+
eventHandlerPropPrefix: "on",
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
"react/jsx-key": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
|
|
129
|
+
"react/jsx-no-constructed-context-values": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-constructed-context-values.md
|
|
130
|
+
// Superseded by @eslint-react/no-leaked-conditional-rendering because it's more
|
|
131
|
+
// accurate by using type information.
|
|
132
|
+
"react/jsx-no-leaked-render": "off", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-leaked-render.md
|
|
133
|
+
"react/jsx-no-script-url": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-script-url.md
|
|
134
|
+
"react/jsx-no-undef": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
|
|
135
|
+
"react/jsx-pascal-case": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
|
|
136
|
+
"react/jsx-props-no-spread-multi": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spread-multi.md
|
|
137
|
+
"react/no-access-state-in-setstate": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-access-state-in-setstate.md
|
|
138
|
+
"react/no-array-index-key": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
|
|
139
|
+
"react/no-danger": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger.md
|
|
140
|
+
"react/no-did-mount-set-state": ["warn", "disallow-in-func"], // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
|
|
141
|
+
"react/no-did-update-set-state": ["warn", "disallow-in-func"], // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
|
|
142
|
+
"react/no-invalid-html-attribute": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-invalid-html-attribute.md
|
|
143
|
+
"react/no-redundant-should-component-update": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-redundant-should-component-update.md
|
|
144
|
+
"react/no-this-in-sfc": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-this-in-sfc.md
|
|
145
|
+
"react/no-typos": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-typos.md
|
|
146
|
+
"react/no-unstable-nested-components": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unstable-nested-components.md
|
|
147
|
+
"react/no-unused-prop-types": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md
|
|
148
|
+
"react/no-unused-state": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-state.md
|
|
149
|
+
"react/no-will-update-set-state": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-will-update-set-state.md
|
|
150
|
+
"react/prefer-es6-class": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
|
|
151
|
+
"react/prefer-stateless-function": [
|
|
152
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
|
|
153
|
+
"warn",
|
|
154
|
+
{
|
|
155
|
+
ignorePureComponents: true,
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
"react/self-closing-comp": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
|
|
159
|
+
"react/style-prop-object": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
|
|
160
|
+
"react/void-dom-elements-no-children": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md
|
|
161
|
+
"@eslint-react/naming-convention/use-state": "warn", // https://eslint-react.xyz/docs/rules/naming-convention-use-state
|
|
162
|
+
"@eslint-react/no-leaked-conditional-rendering": "warn", // https://eslint-react.xyz/docs/rules/no-leaked-conditional-rendering
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
];
|
|
166
|
+
export default react;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import preferArrow from "eslint-plugin-prefer-arrow";
|
|
2
|
+
import tsEslint from "typescript-eslint";
|
|
3
|
+
import { globPatterns } from "../lib/glob-patterns.js";
|
|
4
|
+
import { ruleOptions } from "../lib/rule-options.js";
|
|
5
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
6
|
+
export const typescript =
|
|
7
|
+
// We need to do a type assertion here because tsEslint.config() returns
|
|
8
|
+
// something that is not assignable to import("eslint").Linter.Config[].
|
|
9
|
+
// This seems to be a type inconsistency between eslint and typescript-eslint.
|
|
10
|
+
/** @type {import("eslint").Linter.Config[]} */ (tsEslint.config(...tsEslint.configs.strictTypeChecked, ...tsEslint.configs.stylisticTypeChecked, {
|
|
11
|
+
languageOptions: {
|
|
12
|
+
parserOptions: {
|
|
13
|
+
projectService: true,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
}, {
|
|
17
|
+
files: [
|
|
18
|
+
globPatterns.typescript,
|
|
19
|
+
globPatterns.typescriptAmbient,
|
|
20
|
+
globPatterns.typescriptJsx,
|
|
21
|
+
],
|
|
22
|
+
plugins: {
|
|
23
|
+
"prefer-arrow": preferArrow,
|
|
24
|
+
},
|
|
25
|
+
rules: {
|
|
26
|
+
"@typescript-eslint/array-type": ["warn", { default: "generic" }],
|
|
27
|
+
"@typescript-eslint/ban-ts-comment": [
|
|
28
|
+
// https://typescript-eslint.io/rules/ban-ts-comment
|
|
29
|
+
"warn",
|
|
30
|
+
{
|
|
31
|
+
"ts-expect-error": "allow-with-description",
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
"@typescript-eslint/class-literal-property-style": "off", // https://typescript-eslint.io/rules/class-literal-property-style
|
|
35
|
+
"@typescript-eslint/consistent-type-definitions": ["warn", "type"], // https://typescript-eslint.io/rules/consistent-type-definitions
|
|
36
|
+
"@typescript-eslint/explicit-member-accessibility": [
|
|
37
|
+
// https://typescript-eslint.io/rules/explicit-member-accessibility
|
|
38
|
+
"warn",
|
|
39
|
+
{
|
|
40
|
+
accessibility: "no-public",
|
|
41
|
+
overrides: {
|
|
42
|
+
parameterProperties: "explicit",
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
"@typescript-eslint/method-signature-style": ["warn", "property"], // https://typescript-eslint.io/rules/method-signature-style
|
|
47
|
+
"@typescript-eslint/naming-convention": [
|
|
48
|
+
// https://typescript-eslint.io/rules/naming-convention
|
|
49
|
+
"warn",
|
|
50
|
+
...ruleOptions["@typescript-eslint/naming-convention"].defaultRules,
|
|
51
|
+
],
|
|
52
|
+
"@typescript-eslint/no-base-to-string": "off", // https://typescript-eslint.io/rules/no-base-to-string
|
|
53
|
+
"@typescript-eslint/no-confusing-void-expression": [
|
|
54
|
+
// https://typescript-eslint.io/rules/no-confusing-void-expression
|
|
55
|
+
"off",
|
|
56
|
+
{
|
|
57
|
+
ignoreArrowShorthand: true,
|
|
58
|
+
ignoreVoidOperator: true,
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
"@typescript-eslint/no-empty-function": "off", // https://typescript-eslint.io/rules/no-empty-function
|
|
62
|
+
"@typescript-eslint/no-empty-interface": "off", // https://typescript-eslint.io/rules/no-empty-interface
|
|
63
|
+
// `any` is sometimes useful for small and abstract functions.
|
|
64
|
+
// Should only be used in isolated parts of the codebase.
|
|
65
|
+
// Appropriate usage can only be checked in a PR review.
|
|
66
|
+
"@typescript-eslint/no-explicit-any": [
|
|
67
|
+
// https://typescript-eslint.io/rules/no-explicit-any
|
|
68
|
+
"off",
|
|
69
|
+
{
|
|
70
|
+
fixToUnknown: false,
|
|
71
|
+
ignoreRestArgs: true,
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
"@typescript-eslint/no-non-null-assertion": "off", // https://typescript-eslint.io/rules/no-non-null-assertion
|
|
75
|
+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "off", // https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare
|
|
76
|
+
"@typescript-eslint/no-unnecessary-condition": [
|
|
77
|
+
"warn",
|
|
78
|
+
{
|
|
79
|
+
allowConstantLoopConditions: true,
|
|
80
|
+
},
|
|
81
|
+
], // https://typescript-eslint.io/rules/no-unnecessary-condition
|
|
82
|
+
"@typescript-eslint/no-unnecessary-qualifier": "warn", // https://typescript-eslint.io/rules/no-unnecessary-qualifier
|
|
83
|
+
"@typescript-eslint/no-unsafe-argument": "off", // https://typescript-eslint.io/rules/no-unsafe-argument
|
|
84
|
+
"@typescript-eslint/no-unsafe-assignment": "off", // https://typescript-eslint.io/rules/no-unsafe-assignment
|
|
85
|
+
"@typescript-eslint/no-unsafe-call": "off", // https://typescript-eslint.io/rules/no-unsafe-call
|
|
86
|
+
"@typescript-eslint/no-unsafe-member-access": "off", // https://typescript-eslint.io/rules/no-unsafe-member-access
|
|
87
|
+
"@typescript-eslint/no-unused-expressions": [
|
|
88
|
+
// https://typescript-eslint.io/rules/no-unused-expressions
|
|
89
|
+
"warn",
|
|
90
|
+
{
|
|
91
|
+
allowShortCircuit: true,
|
|
92
|
+
allowTernary: true,
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
"@typescript-eslint/no-unused-vars": [
|
|
96
|
+
// https://typescript-eslint.io/rules/no-unused-vars
|
|
97
|
+
"error",
|
|
98
|
+
ruleOptions["no-unused-vars"],
|
|
99
|
+
],
|
|
100
|
+
"@typescript-eslint/promise-function-async": [
|
|
101
|
+
// https://typescript-eslint.io/rules/promise-function-async
|
|
102
|
+
"warn",
|
|
103
|
+
{
|
|
104
|
+
allowAny: true,
|
|
105
|
+
allowedPromiseNames: [],
|
|
106
|
+
checkArrowFunctions: true,
|
|
107
|
+
checkFunctionDeclarations: true,
|
|
108
|
+
checkFunctionExpressions: true,
|
|
109
|
+
checkMethodDeclarations: true,
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
"@typescript-eslint/require-await": "off", // https://typescript-eslint.io/rules/require-await
|
|
113
|
+
"@typescript-eslint/restrict-plus-operands": "off", // https://typescript-eslint.io/rules/restrict-plus-operands
|
|
114
|
+
"@typescript-eslint/restrict-template-expressions": [
|
|
115
|
+
// https://typescript-eslint.io/rules/restrict-template-expressions
|
|
116
|
+
"off",
|
|
117
|
+
{
|
|
118
|
+
allowBoolean: false,
|
|
119
|
+
allowNullable: false,
|
|
120
|
+
allowNumber: true,
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
// TS' noImplicitReturns catches this already more effectively
|
|
124
|
+
"consistent-return": "off",
|
|
125
|
+
"no-return-await": "off",
|
|
126
|
+
"@typescript-eslint/return-await": ["warn", "in-try-catch"], // https://typescript-eslint.io/rules/return-await
|
|
127
|
+
"@typescript-eslint/switch-exhaustiveness-check": [
|
|
128
|
+
"warn",
|
|
129
|
+
{
|
|
130
|
+
// It should not be necessary to list all possible values for a union type
|
|
131
|
+
// explicitly in a switch statement. E.g. if the types are generated, we don't
|
|
132
|
+
// want to adjust all switch statements every time the types are changed.
|
|
133
|
+
considerDefaultExhaustiveForUnions: true,
|
|
134
|
+
},
|
|
135
|
+
], // https://typescript-eslint.io/rules/switch-exhaustiveness-check
|
|
136
|
+
camelcase: "off",
|
|
137
|
+
"max-lines": [
|
|
138
|
+
"warn",
|
|
139
|
+
{
|
|
140
|
+
max: 1400,
|
|
141
|
+
skipBlankLines: true,
|
|
142
|
+
skipComments: true,
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
"func-style": ["warn", "expression"], // https://eslint.org/docs/latest/rules/func-style
|
|
146
|
+
"prefer-arrow/prefer-arrow-functions": [
|
|
147
|
+
// https://github.com/TristonJ/eslint-plugin-prefer-arrow
|
|
148
|
+
"warn",
|
|
149
|
+
{
|
|
150
|
+
disallowPrototype: false,
|
|
151
|
+
singleReturnOnly: false,
|
|
152
|
+
// We used to enforce arrow functions also for class methods (as class properties)
|
|
153
|
+
// but arrow functions in sub-classes can't call their overridden counterpart
|
|
154
|
+
// in their super-class, see https://stackoverflow.com/a/52823577
|
|
155
|
+
classPropertiesAllowed: false,
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
"@typescript-eslint/use-unknown-in-catch-callback-variable": "off", // https://typescript-eslint.io/rules/use-unknown-in-catch-callback-variable
|
|
159
|
+
},
|
|
160
|
+
}, {
|
|
161
|
+
files: globPatterns.typescriptAmbient,
|
|
162
|
+
rules: {
|
|
163
|
+
// In d.ts files it might be necessary to merge an existing interface
|
|
164
|
+
"@typescript-eslint/consistent-type-definitions": "off", // https://typescript-eslint.io/rules/consistent-type-definitions
|
|
165
|
+
// In d.ts files it's sometimes necessary to overload existing methods
|
|
166
|
+
"@typescript-eslint/method-signature-style": "off", // https://typescript-eslint.io/rules/method-signature-style
|
|
167
|
+
"@typescript-eslint/naming-convention": "off", // https://typescript-eslint.io/rules/naming-convention
|
|
168
|
+
// Unused vars can be common in d.ts files when declaration merging is used
|
|
169
|
+
"@typescript-eslint/no-unused-vars": "off", // https://typescript-eslint.io/rules/no-unused-vars
|
|
170
|
+
// Since d.ts files are used to type external modules, we can't control the coding style
|
|
171
|
+
"import/no-default-export": "off",
|
|
172
|
+
// When someone wants to extend the typings of a third-party module, it might
|
|
173
|
+
// be necessary to import the module so that TypeScript finds the typings that should be extended.
|
|
174
|
+
// This is a better alternative to the triple-slash directive
|
|
175
|
+
"import/no-unassigned-import": "off",
|
|
176
|
+
},
|
|
177
|
+
}, {
|
|
178
|
+
files: globPatterns.tests,
|
|
179
|
+
rules: {
|
|
180
|
+
// Type assertions are quite common in tests
|
|
181
|
+
"@typescript-eslint/consistent-type-assertions": "off", // https://typescript-eslint.io/rules/consistent-type-assertions
|
|
182
|
+
// Mocking often requires to mock objects with a different naming convention
|
|
183
|
+
"@typescript-eslint/naming-convention": "off", // https://typescript-eslint.io/rules/naming-convention
|
|
184
|
+
// We allow any to be used in tests, so returning it is ok
|
|
185
|
+
"@typescript-eslint/no-unsafe-return": "off", // https://typescript-eslint.io/rules/no-unsafe-return
|
|
186
|
+
// chai uses these as assertions
|
|
187
|
+
"@typescript-eslint/no-unused-expressions": "off", // https://typescript-eslint.io/rules/no-unused-expressions
|
|
188
|
+
// It's uncommon to use async/await in Cypress tests
|
|
189
|
+
// https://docs.cypress.io/guides/core-concepts/introduction-to-cypress.html#Commands-Are-Asynchronous
|
|
190
|
+
"@typescript-eslint/promise-function-async": "off", // https://typescript-eslint.io/rules/promise-function-async
|
|
191
|
+
// Passing functions around like this can be common with mocking
|
|
192
|
+
"@typescript-eslint/unbound-method": "off", // https://typescript-eslint.io/rules/unbound-method
|
|
193
|
+
},
|
|
194
|
+
}));
|
|
195
|
+
export default typescript;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { globPatterns } from "../lib/glob-patterns.js";
|
|
2
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
3
|
+
export const jsxNoLiterals = [
|
|
4
|
+
{
|
|
5
|
+
files: [globPatterns.jsx, globPatterns.typescriptJsx],
|
|
6
|
+
rules: {
|
|
7
|
+
// If we don't adjust this rule, it would autofix the escape hatch
|
|
8
|
+
// {"some string"} allowed by "jsx-no-literals"
|
|
9
|
+
"react/jsx-curly-brace-presence": [
|
|
10
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
|
|
11
|
+
"warn",
|
|
12
|
+
{
|
|
13
|
+
children: "always",
|
|
14
|
+
props: "never",
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
"react/jsx-no-literals": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
files: globPatterns.tests,
|
|
22
|
+
rules: {
|
|
23
|
+
// It's quite common in tests to use example strings
|
|
24
|
+
"react/jsx-curly-brace-presence": ["warn", "never"],
|
|
25
|
+
"react/jsx-no-literals": "off",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
export default jsxNoLiterals;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
2
|
+
export const noDefaultExport = [
|
|
3
|
+
{
|
|
4
|
+
// Config files often have a single default export
|
|
5
|
+
ignores: ["*.config.{js,ts}"],
|
|
6
|
+
rules: {
|
|
7
|
+
"no-restricted-syntax": [
|
|
8
|
+
"error",
|
|
9
|
+
{
|
|
10
|
+
selector: "ExportDefaultDeclaration",
|
|
11
|
+
message: "Please use named exports instead. Named exports ensure consistent naming and make it easier to auto-import symbols.",
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
];
|
|
17
|
+
// Such irony... 🙃
|
|
18
|
+
export default noDefaultExport;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
2
|
+
export const preferInterface = [
|
|
3
|
+
{
|
|
4
|
+
rules: {
|
|
5
|
+
"@typescript-eslint/consistent-type-definitions": ["warn", "interface"], // https://typescript-eslint.io/rules/consistent-type-definitions
|
|
6
|
+
},
|
|
7
|
+
},
|
|
8
|
+
];
|
|
9
|
+
export default preferInterface;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ## Base config for Prettier.
|
|
3
|
+
*
|
|
4
|
+
* Our base config is entirely based on Prettier's default config. Besides that,
|
|
5
|
+
* it also:
|
|
6
|
+
*
|
|
7
|
+
* - Auto-sorts `import` statements
|
|
8
|
+
* - Formats JSDoc comments
|
|
9
|
+
* - Formats `package.json`
|
|
10
|
+
* - Formats and sorts CSS properties
|
|
11
|
+
* - Sorts Tailwind CSS class names
|
|
12
|
+
*
|
|
13
|
+
* @module prettierConfig
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* @param {string} id
|
|
17
|
+
* @returns {string}
|
|
18
|
+
*/
|
|
19
|
+
function safeResolve(id) {
|
|
20
|
+
return "resolve" in import.meta
|
|
21
|
+
? import.meta.resolve(id).slice("file://".length)
|
|
22
|
+
: id;
|
|
23
|
+
}
|
|
24
|
+
// Using safeResolve() here because the plugins might not be installed in the parent app/module
|
|
25
|
+
// and we don't want to rely on the package manager to hoist the dependencies.
|
|
26
|
+
const plugins = await Promise.all([
|
|
27
|
+
safeResolve("@ianvs/prettier-plugin-sort-imports"),
|
|
28
|
+
safeResolve("prettier-plugin-jsdoc"),
|
|
29
|
+
safeResolve("prettier-plugin-packagejson"),
|
|
30
|
+
safeResolve("prettier-plugin-css-order"),
|
|
31
|
+
safeResolve("prettier-plugin-tailwindcss"),
|
|
32
|
+
]);
|
|
33
|
+
/**
|
|
34
|
+
* Provides the default configuration for Prettier with customized plugins and
|
|
35
|
+
* sorting rules.
|
|
36
|
+
*
|
|
37
|
+
* @type {import("prettier").Config}
|
|
38
|
+
*/
|
|
39
|
+
export const config = {
|
|
40
|
+
plugins,
|
|
41
|
+
importOrderParserPlugins: [
|
|
42
|
+
"typescript",
|
|
43
|
+
"jsx",
|
|
44
|
+
"decorators",
|
|
45
|
+
"importAttributes",
|
|
46
|
+
],
|
|
47
|
+
importOrderTypeScriptVersion: "5.0.0",
|
|
48
|
+
cssDeclarationSorterOrder: "smacss",
|
|
49
|
+
cssDeclarationSorterKeepOverrides: false,
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* @type {import("prettier").Config}
|
|
53
|
+
* @see {config}
|
|
54
|
+
*/
|
|
55
|
+
export default config;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** @type {import("semantic-release").Options} */
|
|
2
|
+
export const config = {
|
|
3
|
+
branches: [
|
|
4
|
+
{
|
|
5
|
+
name: "main",
|
|
6
|
+
channel: "latest",
|
|
7
|
+
},
|
|
8
|
+
{ name: "beta", prerelease: true },
|
|
9
|
+
],
|
|
10
|
+
plugins: [
|
|
11
|
+
"@semantic-release/commit-analyzer",
|
|
12
|
+
"@semantic-release/release-notes-generator",
|
|
13
|
+
"@semantic-release/changelog",
|
|
14
|
+
[
|
|
15
|
+
"@semantic-release/exec",
|
|
16
|
+
{
|
|
17
|
+
prepareCmd: "npx -y prettier --write CHANGELOG.md",
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
[
|
|
21
|
+
"@semantic-release/git",
|
|
22
|
+
{
|
|
23
|
+
assets: ["CHANGELOG.md"],
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
"@semantic-release/npm",
|
|
28
|
+
{
|
|
29
|
+
tarballDir: ".semantic-release",
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
[
|
|
33
|
+
"@semantic-release/github",
|
|
34
|
+
{
|
|
35
|
+
assets: ".semantic-release/*.tgz",
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
export default config;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {{ github: boolean; jsr: boolean }} options?
|
|
3
|
+
* @returns {import("semantic-release").Options}
|
|
4
|
+
*/
|
|
1
5
|
export function config({ github, jsr }?: {
|
|
2
6
|
github: boolean;
|
|
3
7
|
jsr: boolean;
|
|
4
8
|
}): import("semantic-release").Options;
|
|
5
9
|
declare const _default: import("semantic-release").Options;
|
|
6
10
|
export default _default;
|
|
7
|
-
//# sourceMappingURL=cross-publish.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { config as baseConfig } from "./base.js";
|
|
2
|
+
/**
|
|
3
|
+
* @param {{ github: boolean; jsr: boolean }} options?
|
|
4
|
+
* @returns {import("semantic-release").Options}
|
|
5
|
+
*/
|
|
6
|
+
export function config({ github = false, jsr = false } = { github: true, jsr: true }) {
|
|
7
|
+
/** @type {import("semantic-release").PluginSpec[]} */
|
|
8
|
+
const plugins = [];
|
|
9
|
+
if (baseConfig.plugins) {
|
|
10
|
+
plugins.push(...baseConfig.plugins);
|
|
11
|
+
}
|
|
12
|
+
if (github) {
|
|
13
|
+
plugins.push([
|
|
14
|
+
"@semantic-release/exec",
|
|
15
|
+
{
|
|
16
|
+
verifyConditionsCmd:
|
|
17
|
+
// eslint-disable-next-line no-template-curly-in-string
|
|
18
|
+
'echo "registry=https://npm.pkg.github.com/\n//npm.pkg.github.com/:_authToken=${process.env.GITHUB_TOKEN}" > /tmp/github.npmrc && npm whoami --userconfig /tmp/github.npmrc',
|
|
19
|
+
publishCmd:
|
|
20
|
+
// eslint-disable-next-line no-template-curly-in-string
|
|
21
|
+
"npm publish --userconfig /tmp/github.npmrc --tag ${nextRelease.channel} --no-git-tag-version",
|
|
22
|
+
successCmd: "rm /tmp/github.npmrc",
|
|
23
|
+
failCmd: "rm /tmp/github.npmrc",
|
|
24
|
+
},
|
|
25
|
+
]);
|
|
26
|
+
}
|
|
27
|
+
if (jsr) {
|
|
28
|
+
plugins.push("@sebbo2002/semantic-release-jsr");
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
...baseConfig,
|
|
32
|
+
plugins,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export default config();
|