@peerigon/configs 1.0.0-beta.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/LICENSE +21 -0
- package/README.md +452 -0
- package/eslint/lib/glob-patterns.js +11 -0
- package/eslint/lib/rule-options.js +130 -0
- package/eslint/presets/javascript-browser.js +6 -0
- package/eslint/presets/javascript-node.js +6 -0
- package/eslint/presets/javascript.js +5 -0
- package/eslint/presets/javascript.test/eslint.config.js +1 -0
- package/eslint/presets/javascript.test/main.js +62 -0
- package/eslint/presets/javascript.test/other.js +2 -0
- package/eslint/presets/typescript-node.js +13 -0
- package/eslint/presets/typescript-react.js +15 -0
- package/eslint/presets/typescript-react.test/App.tsx +45 -0
- package/eslint/presets/typescript-react.test/Other.tsx +5 -0
- package/eslint/presets/typescript-react.test/eslint.config.js +1 -0
- package/eslint/presets/typescript-react.test/tsconfig.json +7 -0
- package/eslint/presets/typescript.js +6 -0
- package/eslint/presets/typescript.test/eslint.config.js +1 -0
- package/eslint/presets/typescript.test/main.ts +31 -0
- package/eslint/presets/typescript.test/message.ts +3 -0
- package/eslint/presets/typescript.test/test.json +1 -0
- package/eslint/presets/typescript.test/tsconfig.json +4 -0
- package/eslint/presets/typescript.test/types.d.ts +11 -0
- package/eslint/rules/base.js +18 -0
- package/eslint/rules/browser.js +12 -0
- package/eslint/rules/javascript.js +147 -0
- package/eslint/rules/node.js +12 -0
- package/eslint/rules/react.js +169 -0
- package/eslint/rules/typescript.js +198 -0
- package/eslint/styles/jsx-no-literals.js +31 -0
- package/eslint/styles/jsx-no-literals.test/eslint.config.js +4 -0
- package/eslint/styles/jsx-no-literals.test/main.tsx +4 -0
- package/eslint/styles/jsx-no-literals.test/tsconfig.json +7 -0
- package/eslint/styles/no-default-export.js +19 -0
- package/eslint/styles/no-default-export.test/eslint.config.js +4 -0
- package/eslint/styles/no-default-export.test/main.ts +2 -0
- package/eslint/styles/no-default-export.test/tsconfig.json +4 -0
- package/eslint/styles/no-null.js +10 -0
- package/eslint/styles/no-null.test/eslint.config.js +4 -0
- package/eslint/styles/no-null.test/main.ts +2 -0
- package/eslint/styles/no-null.test/tsconfig.json +4 -0
- package/eslint/styles/prefer-array-shorthand.js +15 -0
- package/eslint/styles/prefer-array-shorthand.test/eslint.config.js +4 -0
- package/eslint/styles/prefer-array-shorthand.test/main.ts +4 -0
- package/eslint/styles/prefer-array-shorthand.test/tsconfig.json +4 -0
- package/eslint/styles/prefer-interface.js +10 -0
- package/eslint/styles/prefer-interface.test/eslint.config.js +4 -0
- package/eslint/styles/prefer-interface.test/main.ts +8 -0
- package/eslint/styles/prefer-interface.test/tsconfig.json +4 -0
- package/eslint/types.d.ts +48 -0
- package/package.json +108 -0
- package/prettier/base.js +30 -0
- package/typescript/base.json +20 -0
|
@@ -0,0 +1,198 @@
|
|
|
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
|
+
|
|
6
|
+
// Type annotation doesn't work here because of type inconsistencies
|
|
7
|
+
// between eslint and typescript-eslint.
|
|
8
|
+
/*
|
|
9
|
+
* @type {Array<import("eslint").Linter.Config>}
|
|
10
|
+
*/
|
|
11
|
+
export const typescript = tsEslint.config(
|
|
12
|
+
...tsEslint.configs.strictTypeChecked,
|
|
13
|
+
...tsEslint.configs.stylisticTypeChecked,
|
|
14
|
+
/** @type {import("eslint").Linter.Config} */
|
|
15
|
+
{
|
|
16
|
+
languageOptions: {
|
|
17
|
+
parserOptions: {
|
|
18
|
+
projectService: true,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
/** @type {import("eslint").Linter.Config} */
|
|
23
|
+
{
|
|
24
|
+
files: [
|
|
25
|
+
globPatterns.typescript,
|
|
26
|
+
globPatterns.typescriptAmbient,
|
|
27
|
+
globPatterns.typescriptJsx,
|
|
28
|
+
],
|
|
29
|
+
plugins: {
|
|
30
|
+
["prefer-arrow"]: preferArrow,
|
|
31
|
+
},
|
|
32
|
+
rules: {
|
|
33
|
+
"@typescript-eslint/array-type": ["warn", { default: "generic" }],
|
|
34
|
+
"@typescript-eslint/ban-ts-comment": [
|
|
35
|
+
// https://typescript-eslint.io/rules/ban-ts-comment
|
|
36
|
+
"warn",
|
|
37
|
+
{
|
|
38
|
+
"ts-expect-error": "allow-with-description",
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
"@typescript-eslint/class-literal-property-style": "off", // https://typescript-eslint.io/rules/class-literal-property-style
|
|
42
|
+
"@typescript-eslint/consistent-type-definitions": ["warn", "type"], // https://typescript-eslint.io/rules/consistent-type-definitions
|
|
43
|
+
"@typescript-eslint/explicit-member-accessibility": [
|
|
44
|
+
// https://typescript-eslint.io/rules/explicit-member-accessibility
|
|
45
|
+
"warn",
|
|
46
|
+
{
|
|
47
|
+
accessibility: "no-public",
|
|
48
|
+
overrides: {
|
|
49
|
+
parameterProperties: "explicit",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
"@typescript-eslint/method-signature-style": ["warn", "property"], // https://typescript-eslint.io/rules/method-signature-style
|
|
54
|
+
"@typescript-eslint/naming-convention": [
|
|
55
|
+
// https://typescript-eslint.io/rules/naming-convention
|
|
56
|
+
"warn",
|
|
57
|
+
...ruleOptions["@typescript-eslint/naming-convention"].defaultRules,
|
|
58
|
+
],
|
|
59
|
+
"@typescript-eslint/no-base-to-string": "off", // https://typescript-eslint.io/rules/no-base-to-string
|
|
60
|
+
"@typescript-eslint/no-confusing-void-expression": [
|
|
61
|
+
// https://typescript-eslint.io/rules/no-confusing-void-expression
|
|
62
|
+
"off",
|
|
63
|
+
{
|
|
64
|
+
ignoreArrowShorthand: true,
|
|
65
|
+
ignoreVoidOperator: true,
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
"@typescript-eslint/no-empty-function": "off", // https://typescript-eslint.io/rules/no-empty-function
|
|
69
|
+
"@typescript-eslint/no-empty-interface": "off", // https://typescript-eslint.io/rules/no-empty-interface
|
|
70
|
+
// `any` is sometimes useful for small and abstract functions.
|
|
71
|
+
// Should only be used in isolated parts of the codebase.
|
|
72
|
+
// Appropriate usage can only be checked in a PR review.
|
|
73
|
+
"@typescript-eslint/no-explicit-any": [
|
|
74
|
+
// https://typescript-eslint.io/rules/no-explicit-any
|
|
75
|
+
"off",
|
|
76
|
+
{
|
|
77
|
+
fixToUnknown: false,
|
|
78
|
+
ignoreRestArgs: true,
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
"@typescript-eslint/no-non-null-assertion": "off", // https://typescript-eslint.io/rules/no-non-null-assertion
|
|
82
|
+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "off", // https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare
|
|
83
|
+
"@typescript-eslint/no-unnecessary-condition": [
|
|
84
|
+
"warn",
|
|
85
|
+
{
|
|
86
|
+
allowConstantLoopConditions: true,
|
|
87
|
+
},
|
|
88
|
+
], // https://typescript-eslint.io/rules/no-unnecessary-condition
|
|
89
|
+
"@typescript-eslint/no-unnecessary-qualifier": "warn", // https://typescript-eslint.io/rules/no-unnecessary-qualifier
|
|
90
|
+
"@typescript-eslint/no-unsafe-argument": "off", // https://typescript-eslint.io/rules/no-unsafe-argument
|
|
91
|
+
"@typescript-eslint/no-unsafe-assignment": "off", // https://typescript-eslint.io/rules/no-unsafe-assignment
|
|
92
|
+
"@typescript-eslint/no-unsafe-call": "off", // https://typescript-eslint.io/rules/no-unsafe-call
|
|
93
|
+
"@typescript-eslint/no-unsafe-member-access": "off", // https://typescript-eslint.io/rules/no-unsafe-member-access
|
|
94
|
+
"@typescript-eslint/no-unused-expressions": [
|
|
95
|
+
// https://typescript-eslint.io/rules/no-unused-expressions
|
|
96
|
+
"warn",
|
|
97
|
+
{
|
|
98
|
+
allowShortCircuit: true,
|
|
99
|
+
allowTernary: true,
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
"@typescript-eslint/no-unused-vars": [
|
|
103
|
+
// https://typescript-eslint.io/rules/no-unused-vars
|
|
104
|
+
"error",
|
|
105
|
+
ruleOptions["no-unused-vars"],
|
|
106
|
+
],
|
|
107
|
+
"@typescript-eslint/promise-function-async": [
|
|
108
|
+
// https://typescript-eslint.io/rules/promise-function-async
|
|
109
|
+
"warn",
|
|
110
|
+
{
|
|
111
|
+
allowAny: true,
|
|
112
|
+
allowedPromiseNames: [],
|
|
113
|
+
checkArrowFunctions: true,
|
|
114
|
+
checkFunctionDeclarations: true,
|
|
115
|
+
checkFunctionExpressions: true,
|
|
116
|
+
checkMethodDeclarations: true,
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
"@typescript-eslint/require-await": "off", // https://typescript-eslint.io/rules/require-await
|
|
120
|
+
"@typescript-eslint/restrict-plus-operands": "off", // https://typescript-eslint.io/rules/restrict-plus-operands
|
|
121
|
+
"@typescript-eslint/restrict-template-expressions": [
|
|
122
|
+
// https://typescript-eslint.io/rules/restrict-template-expressions
|
|
123
|
+
"off",
|
|
124
|
+
{
|
|
125
|
+
allowBoolean: false,
|
|
126
|
+
allowNullable: false,
|
|
127
|
+
allowNumber: true,
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
"no-return-await": "off",
|
|
131
|
+
"@typescript-eslint/return-await": ["warn", "in-try-catch"], // https://typescript-eslint.io/rules/return-await
|
|
132
|
+
"@typescript-eslint/switch-exhaustiveness-check": "warn", // https://typescript-eslint.io/rules/switch-exhaustiveness-check
|
|
133
|
+
camelcase: "off",
|
|
134
|
+
"max-lines": [
|
|
135
|
+
"warn",
|
|
136
|
+
{
|
|
137
|
+
max: 1400,
|
|
138
|
+
skipBlankLines: true,
|
|
139
|
+
skipComments: true,
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
"func-style": ["warn", "expression"], // https://eslint.org/docs/latest/rules/func-style
|
|
143
|
+
"prefer-arrow/prefer-arrow-functions": [
|
|
144
|
+
// https://github.com/TristonJ/eslint-plugin-prefer-arrow
|
|
145
|
+
"warn",
|
|
146
|
+
{
|
|
147
|
+
disallowPrototype: false,
|
|
148
|
+
singleReturnOnly: false,
|
|
149
|
+
// We used to enforce arrow functions also for class methods (as class properties)
|
|
150
|
+
// but arrow functions in sub-classes can't call their overridden counterpart
|
|
151
|
+
// in their super-class, see https://stackoverflow.com/a/52823577
|
|
152
|
+
classPropertiesAllowed: false,
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
"@typescript-eslint/use-unknown-in-catch-callback-variable": "off", // https://typescript-eslint.io/rules/use-unknown-in-catch-callback-variable
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
/** @type {import("eslint").Linter.Config} */
|
|
159
|
+
{
|
|
160
|
+
files: globPatterns.typescriptAmbient,
|
|
161
|
+
rules: {
|
|
162
|
+
// In d.ts files it might be necessary to merge an existing interface
|
|
163
|
+
"@typescript-eslint/consistent-type-definitions": "off", // https://typescript-eslint.io/rules/consistent-type-definitions
|
|
164
|
+
// In d.ts files it's sometimes necessary to overload existing methods
|
|
165
|
+
"@typescript-eslint/method-signature-style": "off", // https://typescript-eslint.io/rules/method-signature-style
|
|
166
|
+
"@typescript-eslint/naming-convention": "off", // https://typescript-eslint.io/rules/naming-convention
|
|
167
|
+
// Unused vars can be common in d.ts files when declaration merging is used
|
|
168
|
+
"@typescript-eslint/no-unused-vars": "off", // https://typescript-eslint.io/rules/no-unused-vars
|
|
169
|
+
// Since d.ts files are used to type external modules, we can't control the coding style
|
|
170
|
+
"import/no-default-export": "off",
|
|
171
|
+
// When someone wants to extend the typings of a third-party module, it might
|
|
172
|
+
// be necessary to import the module so that TypeScript finds the typings that should be extended.
|
|
173
|
+
// This is a better alternative to the triple-slash directive
|
|
174
|
+
"import/no-unassigned-import": "off",
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
/** @type {import("eslint").Linter.Config} */
|
|
178
|
+
{
|
|
179
|
+
files: globPatterns.tests,
|
|
180
|
+
rules: {
|
|
181
|
+
// Type assertions are quite common in tests
|
|
182
|
+
"@typescript-eslint/consistent-type-assertions": "off", // https://typescript-eslint.io/rules/consistent-type-assertions
|
|
183
|
+
// Mocking often requires to mock objects with a different naming convention
|
|
184
|
+
"@typescript-eslint/naming-convention": "off", // https://typescript-eslint.io/rules/naming-convention
|
|
185
|
+
// We allow any to be used in tests, so returning it is ok
|
|
186
|
+
"@typescript-eslint/no-unsafe-return": "off", // https://typescript-eslint.io/rules/no-unsafe-return
|
|
187
|
+
// chai uses these as assertions
|
|
188
|
+
"@typescript-eslint/no-unused-expressions": "off", // https://typescript-eslint.io/rules/no-unused-expressions
|
|
189
|
+
// It's uncommon to use async/await in Cypress tests
|
|
190
|
+
// https://docs.cypress.io/guides/core-concepts/introduction-to-cypress.html#Commands-Are-Asynchronous
|
|
191
|
+
"@typescript-eslint/promise-function-async": "off", // https://typescript-eslint.io/rules/promise-function-async
|
|
192
|
+
// Passing functions around like this can be common with mocking
|
|
193
|
+
"@typescript-eslint/unbound-method": "off", // https://typescript-eslint.io/rules/unbound-method
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
export default typescript;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { globPatterns } from "../lib/glob-patterns.js";
|
|
2
|
+
|
|
3
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
4
|
+
export const jsxNoLiterals = [
|
|
5
|
+
{
|
|
6
|
+
files: [globPatterns.jsx, globPatterns.typescriptJsx],
|
|
7
|
+
rules: {
|
|
8
|
+
// If we don't adjust this rule, it would autofix the escape hatch
|
|
9
|
+
// {"some string"} allowed by "jsx-no-literals"
|
|
10
|
+
"react/jsx-curly-brace-presence": [
|
|
11
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
|
|
12
|
+
"warn",
|
|
13
|
+
{
|
|
14
|
+
children: "always",
|
|
15
|
+
props: "never",
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
"react/jsx-no-literals": "warn", // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
files: globPatterns.tests,
|
|
23
|
+
rules: {
|
|
24
|
+
// It's quite common in tests to use example strings
|
|
25
|
+
"react/jsx-curly-brace-presence": ["warn", "never"],
|
|
26
|
+
"react/jsx-no-literals": "off",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export default jsxNoLiterals;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
2
|
+
export const noDefaultExport = [
|
|
3
|
+
{
|
|
4
|
+
// Config files often have a single default export
|
|
5
|
+
ignores: ["*.config.js"],
|
|
6
|
+
rules: {
|
|
7
|
+
"no-restricted-syntax": [
|
|
8
|
+
"error",
|
|
9
|
+
{
|
|
10
|
+
selector: "ExportDefaultDeclaration",
|
|
11
|
+
message: "Prefer named exports",
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
// Such irony... 🙃
|
|
19
|
+
export default noDefaultExport;
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
|
|
10
|
+
export default preferInterface;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
declare module "eslint-plugin-react" {
|
|
3
|
+
const config: {
|
|
4
|
+
rules: { [name: string]: any };
|
|
5
|
+
languageOptions: { [name: string]: any };
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
configs: {
|
|
10
|
+
flat: {
|
|
11
|
+
recommended: config,
|
|
12
|
+
["jsx-runtime"]: config,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare module "eslint-plugin-prefer-arrow" {
|
|
19
|
+
const config: {
|
|
20
|
+
rules: { [name: string]: any };
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default config;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare module "eslint-plugin-react-compiler" {
|
|
27
|
+
const config: {
|
|
28
|
+
rules: { [name: string]: any };
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default config;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare module "eslint-plugin-react-hooks" {
|
|
35
|
+
const config: {
|
|
36
|
+
rules: { [name: string]: any };
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default config;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare module "eslint-plugin-react-refresh" {
|
|
43
|
+
const config: {
|
|
44
|
+
rules: { [name: string]: any };
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default config;
|
|
48
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@peerigon/configs",
|
|
3
|
+
"version": "1.0.0-beta.1",
|
|
4
|
+
"description": "Configs for ESLint, Prettier, TypeScript & friends",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"eslint",
|
|
7
|
+
"peerigon",
|
|
8
|
+
"configs",
|
|
9
|
+
"typescript",
|
|
10
|
+
"prettier"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/peerigon/configs#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/peerigon/configs/issues"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/peerigon/configs.git"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": "Peerigon GmbH <hello@peerigon.com>",
|
|
22
|
+
"type": "module",
|
|
23
|
+
"exports": {
|
|
24
|
+
"./eslint/presets/javascript-browser": "./eslint/presets/javascript-browser.js",
|
|
25
|
+
"./eslint/presets/javascript-node": "./eslint/presets/javascript-node.js",
|
|
26
|
+
"./eslint/presets/javascript": "./eslint/presets/javascript.js",
|
|
27
|
+
"./eslint/presets/typescript-node": "./eslint/presets/typescript-node.js",
|
|
28
|
+
"./eslint/presets/typescript-react": "./eslint/presets/typescript-react.js",
|
|
29
|
+
"./eslint/presets/typescript": "./eslint/presets/typescript.js",
|
|
30
|
+
"./eslint/styles/jsx-no-literals": "./eslint/styles/jsx-no-literals.js",
|
|
31
|
+
"./eslint/styles/no-default-export": "./eslint/styles/no-default-export.js",
|
|
32
|
+
"./eslint/styles/no-null": "./eslint/styles/no-null.js",
|
|
33
|
+
"./eslint/styles/prefer-array-shorthand": "./eslint/styles/prefer-array-shorthand.js",
|
|
34
|
+
"./eslint/styles/prefer-interface": "./eslint/styles/prefer-interface.js",
|
|
35
|
+
"./prettier": "./prettier/base.js",
|
|
36
|
+
"./typescript": "./typescript/base.js"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"eslint",
|
|
40
|
+
"prettier",
|
|
41
|
+
"typescript"
|
|
42
|
+
],
|
|
43
|
+
"scripts": {
|
|
44
|
+
"test": "run-p test:presets:* test:styles:*",
|
|
45
|
+
"test:presets:javascript": "cd eslint/presets/javascript.test; eslint --max-warnings 0 .",
|
|
46
|
+
"test:presets:typescript": "cd eslint/presets/typescript.test; eslint --max-warnings 0 .",
|
|
47
|
+
"test:presets:typescript-react": "cd eslint/presets/typescript-react.test; eslint --max-warnings 0 .",
|
|
48
|
+
"test:styles:jsx-no-literals": "cd eslint/styles/jsx-no-literals.test; eslint --max-warnings 0 .",
|
|
49
|
+
"test:styles:no-default-export": "cd eslint/styles/no-default-export.test; eslint --max-warnings 0 .",
|
|
50
|
+
"test:styles:no-null": "cd eslint/styles/no-null.test; eslint --max-warnings 0 .",
|
|
51
|
+
"test:styles:prefer-array-shorthand": "cd eslint/styles/prefer-array-shorthand.test; eslint --max-warnings 0 .",
|
|
52
|
+
"test:styles:prefer-interface": "cd eslint/styles/prefer-interface.test; eslint --max-warnings 0 .",
|
|
53
|
+
"test:types": "tsc",
|
|
54
|
+
"test:prettier": "prettier --check .",
|
|
55
|
+
"prepare": "husky",
|
|
56
|
+
"release": "semantic-release"
|
|
57
|
+
},
|
|
58
|
+
"lint-staged": {
|
|
59
|
+
".github/workflows/*.{yml,yaml}": [
|
|
60
|
+
"pin-github-action --allow-empty"
|
|
61
|
+
],
|
|
62
|
+
"*.{js,jsx,ts,tsx,css,md,yml,yaml}": "prettier --write"
|
|
63
|
+
},
|
|
64
|
+
"dependencies": {
|
|
65
|
+
"@eslint-react/eslint-plugin": "^1.15.2",
|
|
66
|
+
"@eslint/compat": "^1.2.2",
|
|
67
|
+
"@eslint/js": "^9.14.0",
|
|
68
|
+
"@ianvs/prettier-plugin-sort-imports": "^4.3.1",
|
|
69
|
+
"eslint-config-prettier": "^9.1.0",
|
|
70
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
71
|
+
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
72
|
+
"eslint-plugin-react": "^7.37.2",
|
|
73
|
+
"eslint-plugin-react-compiler": "^19.0.0-beta-63b359f-20241101",
|
|
74
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
75
|
+
"eslint-plugin-react-refresh": "^0.4.14",
|
|
76
|
+
"eslint-plugin-unicorn": "^56.0.0",
|
|
77
|
+
"globals": "^15.12.0",
|
|
78
|
+
"prettier-plugin-css-order": "^2.1.2",
|
|
79
|
+
"prettier-plugin-jsdoc": "^1.3.0",
|
|
80
|
+
"prettier-plugin-packagejson": "^2.5.3",
|
|
81
|
+
"prettier-plugin-tailwindcss": "^0.6.8",
|
|
82
|
+
"typescript-eslint": "^8.13.0"
|
|
83
|
+
},
|
|
84
|
+
"devDependencies": {
|
|
85
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
86
|
+
"@semantic-release/git": "^10.0.1",
|
|
87
|
+
"@types/eslint-config-prettier": "^6.11.3",
|
|
88
|
+
"@types/eslint-plugin-jsx-a11y": "^6.9.0",
|
|
89
|
+
"@types/eslint__js": "^8.42.3",
|
|
90
|
+
"@types/node": "^22.9.0",
|
|
91
|
+
"@types/react": "^18.3.12",
|
|
92
|
+
"eslint": "^9.14.0",
|
|
93
|
+
"husky": "^9.1.6",
|
|
94
|
+
"lint-staged": "^15.2.10",
|
|
95
|
+
"npm-run-all": "^4.1.5",
|
|
96
|
+
"pin-github-action": "^1.9.1",
|
|
97
|
+
"prettier": "^3.3.3",
|
|
98
|
+
"react": "^18.3.1",
|
|
99
|
+
"semantic-release": "^24.2.0",
|
|
100
|
+
"typescript": "5.6.3"
|
|
101
|
+
},
|
|
102
|
+
"peerDependencies": {
|
|
103
|
+
"eslint": "^9.10.0"
|
|
104
|
+
},
|
|
105
|
+
"publishConfig": {
|
|
106
|
+
"access": "public"
|
|
107
|
+
}
|
|
108
|
+
}
|
package/prettier/base.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} id
|
|
3
|
+
* @returns {string}
|
|
4
|
+
*/
|
|
5
|
+
const safeResolve = (id) => {
|
|
6
|
+
return "resolve" in import.meta
|
|
7
|
+
? import.meta.resolve(id).slice("file://".length)
|
|
8
|
+
: id;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// Using safeResolve() here because the plugins might not be installed in the parent app/module
|
|
12
|
+
// and we don't want to rely on the package manager to hoist the dependencies.
|
|
13
|
+
const plugins = await Promise.all([
|
|
14
|
+
safeResolve("@ianvs/prettier-plugin-sort-imports"),
|
|
15
|
+
safeResolve("prettier-plugin-jsdoc"),
|
|
16
|
+
safeResolve("prettier-plugin-packagejson"),
|
|
17
|
+
safeResolve("prettier-plugin-css-order"),
|
|
18
|
+
safeResolve("prettier-plugin-tailwindcss"),
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
plugins,
|
|
23
|
+
importOrderParserPlugins: [
|
|
24
|
+
"typescript",
|
|
25
|
+
"jsx",
|
|
26
|
+
"decorators",
|
|
27
|
+
"importAttributes",
|
|
28
|
+
],
|
|
29
|
+
importOrderTypeScriptVersion: "5.0.0",
|
|
30
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"checkJs": true,
|
|
4
|
+
"esModuleInterop": true,
|
|
5
|
+
"exactOptionalPropertyTypes": true,
|
|
6
|
+
"forceConsistentCasingInFileNames": true,
|
|
7
|
+
"isolatedModules": true,
|
|
8
|
+
"module": "NodeNext",
|
|
9
|
+
"noEmit": true, // If code should be emitted, it's recommended to create a separate tsconfig.build.json file
|
|
10
|
+
"noImplicitOverride": true,
|
|
11
|
+
"noImplicitReturns": true,
|
|
12
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
13
|
+
"noUncheckedIndexedAccess": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"strict": true,
|
|
17
|
+
"target": "ESNext"
|
|
18
|
+
},
|
|
19
|
+
"$schema": "https://json.schemastore.org/tsconfig"
|
|
20
|
+
}
|