Skip to content

Commit 1e30128

Browse files
committed
first commit
0 parents  commit 1e30128

File tree

11 files changed

+4567
-0
lines changed

11 files changed

+4567
-0
lines changed

.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
dist
3+
!.prettierrc.js
4+
!.eslintrc.js
5+
!.stylelintrc.js

.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: true,
3+
extends: [require.resolve('./dist/eslint')],
4+
}

.gitignore

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

.prettierrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
...require('./dist').prettier,
3+
}

package.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "prefer-code-style",
3+
"version": "1.0.0",
4+
"description": "A common code style rules.",
5+
"main": "index.js",
6+
"scripts": {
7+
"build": "tsc --build tsconfig.json",
8+
"lint": "yarn lint:es",
9+
"lint:es": "eslint --ignore-path \"./.eslintignore\" \"./**/*.{js,jsx,ts,tsx}\"",
10+
"test": "echo \"Error: no test specified\" && exit 1"
11+
},
12+
"repository": {
13+
"type": "git",
14+
"url": "https://github.com/Codennnn"
15+
},
16+
"keywords": [
17+
"code style",
18+
"eslint",
19+
"stylelint",
20+
"prettier"
21+
],
22+
"author": "LeoKu <[email protected]>",
23+
"license": "MIT",
24+
"devDependencies": {
25+
"eslint": "^7.25.0",
26+
"@typescript-eslint/eslint-plugin": "^4.22.0",
27+
"@typescript-eslint/parser": "^4.22.0",
28+
"eslint-config-prettier": "^8.3.0",
29+
"eslint-plugin-import": "^2.22.1",
30+
"eslint-plugin-jsx-a11y": "^6.4.1",
31+
"eslint-plugin-prettier": "^3.4.0",
32+
"eslint-plugin-react": "^7.23.2",
33+
"eslint-plugin-react-hooks": "^4.2.0",
34+
"eslint-plugin-simple-import-sort": "^7.0.0",
35+
"prettier": "^2.2.1",
36+
"stylelint": "^13.13.0",
37+
"stylelint-config-prettier": "^8.0.2",
38+
"stylelint-config-rational-order": "^0.1.2",
39+
"stylelint-config-standard": "^22.0.0",
40+
"stylelint-order": "^4.1.0",
41+
"stylelint-prettier": "^1.2.0",
42+
"stylelint-scss": "^3.19.0",
43+
"typescript": "^4.2.4"
44+
}
45+
}

src/eslint.ts

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

src/index.ts

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

src/prettier.ts

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

src/stylelint.ts

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

tsconfig.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"module": "commonjs",
5+
"baseUrl": ".",
6+
"outDir": "dist",
7+
"strict": true,
8+
"esModuleInterop": true,
9+
"skipLibCheck": true,
10+
"forceConsistentCasingInFileNames": true
11+
},
12+
"include": ["src/*.ts"]
13+
}

0 commit comments

Comments
 (0)