Skip to content

Commit 19688ce

Browse files
committed
chore: build
1 parent 30e7062 commit 19688ce

File tree

11 files changed

+117
-24
lines changed

11 files changed

+117
-24
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
root: true,
3-
extends: [require.resolve('./dist/eslint')],
3+
extends: [require.resolve('./lib/eslint')],
44
}

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
node_modules
2-
dist
3-
!yarn.lock
1+
node_modules

.prettierrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
...require('./dist').prettier,
2+
...require('./lib').prettier,
33
}

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1-
# prefer-code-style
1+
<div align="center">
22

3-
一套适用于 react 框架的代码风格规则。
3+
# Prefer Code Style
4+
5+
**将我喜爱的项目格式化插件集成在一起**
6+
7+
</div>
8+
9+
## 说明
10+
11+
我对项目的格式要求较高,这个项目集成了一些我常用的格式化插件,包括 ESlint、Stylelint、prettier 等衍生的配置。
12+
13+
## 安装
14+
15+
```bash
16+
yarn add -D prefer-code-style
17+
```

index.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

lib/eslint.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
"use strict";
2+
module.exports = {
3+
env: {
4+
node: true,
5+
browser: true,
6+
es6: true,
7+
},
8+
parser: '@typescript-eslint/parser',
9+
extends: [
10+
'eslint:recommended',
11+
'plugin:import/errors',
12+
'plugin:import/warnings',
13+
'plugin:import/typescript',
14+
'plugin:@typescript-eslint/recommended',
15+
'plugin:jsx-a11y/recommended',
16+
'plugin:react/recommended',
17+
'plugin:react-hooks/recommended',
18+
'plugin:prettier/recommended',
19+
],
20+
plugins: ['simple-import-sort'],
21+
rules: {
22+
'simple-import-sort/imports': 1,
23+
'simple-import-sort/exports': 1,
24+
'sort-imports': 0,
25+
'import/order': 0,
26+
'@typescript-eslint/no-var-requires': 0,
27+
'@typescript-eslint/no-non-null-assertion': 0,
28+
'@typescript-eslint/no-use-before-define': 2,
29+
'@typescript-eslint/explicit-module-boundary-types': 0,
30+
'@typescript-eslint/consistent-type-imports': [
31+
2,
32+
{
33+
prefer: 'type-imports',
34+
disallowTypeAnnotations: true,
35+
},
36+
],
37+
'react/jsx-sort-props': [
38+
2,
39+
{
40+
callbacksLast: true,
41+
shorthandFirst: true,
42+
shorthandLast: false,
43+
ignoreCase: false,
44+
noSortAlphabetically: false,
45+
reservedFirst: true,
46+
},
47+
],
48+
},
49+
};

lib/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"use strict";
2+
var eslint = require('./eslint');
3+
var stylelint = require('./stylelint');
4+
var prettier = require('./prettier');
5+
module.exports = {
6+
eslint: eslint,
7+
stylelint: stylelint,
8+
prettier: prettier,
9+
};

lib/prettier.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"use strict";
2+
module.exports = {
3+
arrowParens: 'avoid',
4+
bracketSpacing: true,
5+
jsxBracketSameLine: false,
6+
jsxSingleQuote: false,
7+
printWidth: 80,
8+
quoteProps: 'as-needed',
9+
rangeStart: 0,
10+
rangeEnd: Infinity,
11+
semi: false,
12+
singleQuote: true,
13+
tabWidth: 2,
14+
trailingComma: 'es5',
15+
useTabs: false,
16+
};

lib/stylelint.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"use strict";
2+
module.exports = {
3+
extends: [
4+
'stylelint-config-standard',
5+
'stylelint-prettier/recommended',
6+
'stylelint-config-rational-order',
7+
],
8+
plugins: ['stylelint-scss', 'stylelint-order'],
9+
rules: {
10+
'at-rule-no-unknown': null,
11+
'scss/at-rule-no-unknown': [
12+
true,
13+
{
14+
ignoreAtRules: ['tailwind'],
15+
},
16+
],
17+
},
18+
ignoreFiles: ['build/**/*.css'],
19+
};

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
{
22
"name": "prefer-code-style",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"description": "A common code style rules.",
55
"author": "LeoKu <[email protected]>",
66
"license": "MIT",
7-
"main": "index.js",
7+
"main": "lib/index.js",
88
"files": [
9-
"dist",
10-
"index.js"
9+
"lib"
1110
],
1211
"scripts": {
1312
"build": "tsc --build tsconfig.json",
1413
"lint": "yarn lint:es",
1514
"lint:es": "eslint --ignore-path \"./.eslintignore\" \"./**/*.{js,jsx,ts,tsx}\"",
1615
"test": "echo \"Error: no test specified\" && exit 1"
1716
},
17+
"homepage": "https://github.com/Codennnn/prefer-code-style#readme",
1818
"repository": {
1919
"type": "git",
2020
"url": "https://github.com/Codennnn/prefer-code-style.git"
2121
},
22-
"homepage": "https://github.com/Codennnn/prefer-code-style",
2322
"bugs": {
2423
"url": "https://github.com/Codennnn/prefer-code-style/issues"
2524
},

0 commit comments

Comments
 (0)