@rife/config 0.0.5-beta.9 → 0.0.6-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/.prettierrc.js +21 -14
- package/eslint.mjs +112 -0
- package/package.json +23 -20
- package/tsconfig.json +5 -1
- package/.eslintrc.js +0 -60
- package/.stylelintrc.js +0 -34
package/.prettierrc.js
CHANGED
|
@@ -4,17 +4,24 @@
|
|
|
4
4
|
* @type {any}
|
|
5
5
|
*/
|
|
6
6
|
module.exports = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
printWidth: 135,
|
|
8
|
+
useTabs: false, // 缩进使用空格
|
|
9
|
+
tabWidth: 4,
|
|
10
|
+
semi: true, // 强制加分号
|
|
11
|
+
singleQuote: true, // 强制单引号
|
|
12
|
+
quoteProps: 'as-needed',
|
|
13
|
+
jsxSingleQuote: false,
|
|
14
|
+
trailingComma: 'all',
|
|
15
|
+
bracketSameLine: true, // jsx props结束符在新行
|
|
16
|
+
arrowParens: 'avoid',
|
|
17
|
+
endOfLine: 'lf',
|
|
18
|
+
bracketSpacing: true,
|
|
19
|
+
overrides: [
|
|
20
|
+
{
|
|
21
|
+
files: ['*.wxml'],
|
|
22
|
+
options: {
|
|
23
|
+
parser: 'html',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
}
|
package/eslint.mjs
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* rules : https://eslint.org/docs/latest/rules/
|
|
3
|
+
* typescript-eslint : https://typescript-eslint.io/getting-started/
|
|
4
|
+
* eslint-plugin-import : https://github.com/benmosher/eslint-plugin-import
|
|
5
|
+
* eslint-config-prettier : https://github.com/prettier/eslint-config-prettier
|
|
6
|
+
* @antfu/eslint-config : https://eslint-config.antfu.me/configs
|
|
7
|
+
*/
|
|
8
|
+
import parser from '@typescript-eslint/parser';
|
|
9
|
+
import prettier from 'eslint-config-prettier';
|
|
10
|
+
import importPlugin from 'eslint-plugin-import';
|
|
11
|
+
|
|
12
|
+
export function eslint() {
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
languageOptions: {
|
|
16
|
+
parser,
|
|
17
|
+
ecmaVersion: 'latest',
|
|
18
|
+
},
|
|
19
|
+
plugins: {
|
|
20
|
+
import: importPlugin,
|
|
21
|
+
},
|
|
22
|
+
files: ['**/*.{js,jsx,ts,tsx,mjs,cjs}'],
|
|
23
|
+
// ignores: ['*/node_modules/**/*'],
|
|
24
|
+
rules: {
|
|
25
|
+
'unicode-bom': ['error', 'never'],
|
|
26
|
+
eqeqeq: ['warn', 'always'], // 使用三等号
|
|
27
|
+
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
|
28
|
+
'prefer-const': [
|
|
29
|
+
'error',
|
|
30
|
+
{
|
|
31
|
+
destructuring: 'any',
|
|
32
|
+
ignoreReadBeforeAssign: false,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
'no-useless-computed-key': 'error',
|
|
36
|
+
'object-shorthand': 'error',
|
|
37
|
+
'prefer-template': 'error',
|
|
38
|
+
'import/newline-after-import': ['warn'], // import 语句后新增一行
|
|
39
|
+
'import/no-empty-named-blocks': ['warn'], // 不能空导入
|
|
40
|
+
'import/no-duplicates': ['warn', { 'prefer-inline': true }], // 不能重复从一个文件导入
|
|
41
|
+
'import/no-useless-path-segments': [
|
|
42
|
+
'error',
|
|
43
|
+
{
|
|
44
|
+
noUselessIndex: true,
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
'import/order': [
|
|
48
|
+
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md
|
|
49
|
+
'warn',
|
|
50
|
+
{
|
|
51
|
+
groups: ['builtin', 'external', 'internal', ['parent', 'index', 'sibling'], 'object'],
|
|
52
|
+
pathGroups: [
|
|
53
|
+
{
|
|
54
|
+
pattern: '@rife/**',
|
|
55
|
+
group: 'external',
|
|
56
|
+
position: 'after',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
pattern: '@/**',
|
|
60
|
+
group: 'internal',
|
|
61
|
+
position: 'after',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
pattern: 'src/**',
|
|
65
|
+
group: 'internal',
|
|
66
|
+
position: 'after',
|
|
67
|
+
},
|
|
68
|
+
// https://github.com/import-js/eslint-plugin-import/issues/1239#issuecomment-598064339
|
|
69
|
+
{
|
|
70
|
+
pattern: '**/*.+(css|sass|less|scss|pcss|styl)',
|
|
71
|
+
patternOptions: { dot: true, nocomment: true },
|
|
72
|
+
group: 'unknown',
|
|
73
|
+
position: 'after',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
pattern: '{.,..}/**/*.+(css|sass|less|scss|pcss|styl)',
|
|
77
|
+
patternOptions: { dot: true, nocomment: true },
|
|
78
|
+
group: 'unknown',
|
|
79
|
+
position: 'after',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
pattern: '**/*.+(svg|png|gif|jpg|jpeg|webp|bmp|ico)',
|
|
83
|
+
patternOptions: { dot: true, nocomment: true },
|
|
84
|
+
group: 'unknown',
|
|
85
|
+
position: 'after',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
pattern: '{.,..}/**/*.+(svg|png|gif|jpg|jpeg|webp|bmp|ico)',
|
|
89
|
+
patternOptions: { dot: true, nocomment: true },
|
|
90
|
+
group: 'unknown',
|
|
91
|
+
position: 'after',
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
pathGroupsExcludedImportTypes: [],
|
|
95
|
+
distinctGroup: false,
|
|
96
|
+
'newlines-between': 'always', // import 语句中间新增一行
|
|
97
|
+
named: {
|
|
98
|
+
// 导入名称按字母排序
|
|
99
|
+
enabled: true,
|
|
100
|
+
types: 'types-first',
|
|
101
|
+
},
|
|
102
|
+
alphabetize: {
|
|
103
|
+
// 导入名称按字母排序
|
|
104
|
+
order: 'asc',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
prettier,
|
|
111
|
+
];
|
|
112
|
+
}
|
package/package.json
CHANGED
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rife/config",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6-beta.2",
|
|
4
4
|
"description": "",
|
|
5
|
+
"author": "",
|
|
6
|
+
"license": "ISC",
|
|
7
|
+
"keywords": [],
|
|
8
|
+
"main": "index.js",
|
|
5
9
|
"files": [
|
|
6
10
|
"tsconfig.json",
|
|
7
|
-
".eslintrc.js",
|
|
8
11
|
".prettierrc.js",
|
|
9
|
-
".
|
|
12
|
+
"eslint.mjs"
|
|
10
13
|
],
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"@swc/helpers": "^0.5.1",
|
|
13
|
-
"postcss-less": "^6.0.0",
|
|
14
|
-
"postcss-styled-syntax": "^0.4.0",
|
|
15
|
-
"stylelint": "^15.7.0",
|
|
16
|
-
"stylelint-config-recess-order": "^4.2.0",
|
|
17
|
-
"tslib": "^2.5.3",
|
|
18
|
-
"typescript": "^5.1.3"
|
|
19
|
-
},
|
|
20
14
|
"devDependencies": {
|
|
21
|
-
"@
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"eslint": "^
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
"@typescript-eslint/parser": "^8.20.0",
|
|
16
|
+
"eslint": "^9.18.0",
|
|
17
|
+
"eslint-config-prettier": "^10.0.1",
|
|
18
|
+
"eslint-plugin-import": "^2.31.0",
|
|
19
|
+
"prettier": "^3.4.2"
|
|
20
|
+
},
|
|
21
|
+
"rife": {
|
|
22
|
+
"hostDependencies": {
|
|
23
|
+
"eslint": true
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"hostDependencies": {
|
|
27
|
+
"eslint": true
|
|
28
28
|
},
|
|
29
|
-
"scripts": {
|
|
29
|
+
"scripts": {
|
|
30
|
+
"lint": "eslint . --fix",
|
|
31
|
+
"release": "pnpm publish --registry https://registry.npmjs.org --no-git-checks"
|
|
32
|
+
}
|
|
30
33
|
}
|
package/tsconfig.json
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"declaration": true,
|
|
12
12
|
"noImplicitAny": true,
|
|
13
13
|
"noUnusedLocals": false,
|
|
14
|
+
"noUnusedParameters": false,
|
|
14
15
|
"noImplicitReturns": true,
|
|
15
16
|
"noFallthroughCasesInSwitch": true,
|
|
16
17
|
"moduleResolution": "node",
|
|
@@ -22,7 +23,10 @@
|
|
|
22
23
|
"importHelpers": true,
|
|
23
24
|
"jsx": "react",
|
|
24
25
|
"useUnknownInCatchVariables": false,
|
|
25
|
-
"forceConsistentCasingInFileNames": true
|
|
26
|
+
"forceConsistentCasingInFileNames": true,
|
|
27
|
+
"incremental": true,
|
|
28
|
+
"noImplicitThis": true,
|
|
29
|
+
"alwaysStrict": true
|
|
26
30
|
},
|
|
27
31
|
"include": ["./src/**/*"]
|
|
28
32
|
}
|
package/.eslintrc.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* rules : https://eslint.org/docs/latest/
|
|
3
|
-
* typescript-eslint : https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/README.md
|
|
4
|
-
* eslint-plugin-import : https://github.com/benmosher/eslint-plugin-import
|
|
5
|
-
* eslint-config-prettier : https://github.com/prettier/eslint-config-prettier
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @type {any}
|
|
10
|
-
*/
|
|
11
|
-
module.exports = {
|
|
12
|
-
parser: '@typescript-eslint/parser',
|
|
13
|
-
plugins: ['@typescript-eslint', 'import'],
|
|
14
|
-
extends: ['prettier'],
|
|
15
|
-
rules: {
|
|
16
|
-
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
|
17
|
-
'object-shorthand': ['warn', 'always'],
|
|
18
|
-
'import/no-duplicates': ['warn'],
|
|
19
|
-
'import/newline-after-import': ['warn'], // import 语句后新增一行
|
|
20
|
-
'import/order': [
|
|
21
|
-
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md
|
|
22
|
-
'warn',
|
|
23
|
-
{
|
|
24
|
-
groups: ['builtin', 'external', 'internal', ['parent', 'index', 'sibling'], 'object'],
|
|
25
|
-
pathGroups: [
|
|
26
|
-
{
|
|
27
|
-
pattern: '@rife/**',
|
|
28
|
-
group: 'external',
|
|
29
|
-
position: 'after',
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
pattern: '@/**',
|
|
33
|
-
group: 'internal',
|
|
34
|
-
position: 'after',
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
pattern: 'src/**',
|
|
38
|
-
group: 'internal',
|
|
39
|
-
position: 'after',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
// https://github.com/import-js/eslint-plugin-import/issues/1239#issuecomment-598064339
|
|
43
|
-
pattern: './*.less',
|
|
44
|
-
group: 'sibling',
|
|
45
|
-
position: 'after',
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
// https://github.com/import-js/eslint-plugin-import/issues/1239#issuecomment-598064339
|
|
49
|
-
pattern: './*.scss',
|
|
50
|
-
group: 'sibling',
|
|
51
|
-
position: 'after',
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
pathGroupsExcludedImportTypes: [],
|
|
55
|
-
distinctGroup: false,
|
|
56
|
-
'newlines-between': 'always', // import 语句中间新增一行
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
},
|
|
60
|
-
};
|
package/.stylelintrc.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// https://stylelint.io/user-guide/configure
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @type {any}
|
|
5
|
-
*/
|
|
6
|
-
module.exports = {
|
|
7
|
-
extends: ['stylelint-config-recess-order'], // 对属性自动排序
|
|
8
|
-
customSyntax: 'postcss-less', // postcss-less postcss-styled-syntax
|
|
9
|
-
overrides: [
|
|
10
|
-
{
|
|
11
|
-
files: ['**/*.less'],
|
|
12
|
-
customSyntax: 'postcss-less',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
files: ['**/*.ts', '**/*.tsx'],
|
|
16
|
-
customSyntax: 'postcss-styled-syntax',
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
rules: {
|
|
20
|
-
// https://stylelint.io/user-guide/rules/list/at-rule-empty-line-before
|
|
21
|
-
'rule-empty-line-before': [
|
|
22
|
-
'always',
|
|
23
|
-
{
|
|
24
|
-
except: ['first-nested', 'after-single-line-comment'],
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
|
|
28
|
-
// https://stylelint.io/user-guide/rules/list/declaration-block-semicolon-newline-after
|
|
29
|
-
'declaration-block-semicolon-newline-after': ['always'],
|
|
30
|
-
|
|
31
|
-
'declaration-empty-line-before': ['never'],
|
|
32
|
-
},
|
|
33
|
-
ignoreFiles: ['node_modules'],
|
|
34
|
-
};
|