Skip to content

Commit 0a8e1e8

Browse files
committed
style: set eslint
affects: @logicflow/core, @logicflow/extension, site
1 parent 7edae48 commit 0a8e1e8

File tree

9 files changed

+245
-147
lines changed

9 files changed

+245
-147
lines changed

Diff for: .commitlintrc.js

+32-34
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
11
module.exports = {
2-
extents:[
3-
"@commitlint/config-conventional"
4-
],
5-
rules:{
6-
'body-leading-blank': [1, 'always'],
7-
'footer-leading-blank': [1, 'always'],
8-
'header-max-length': [2, 'always', 72],
9-
'scope-case': [2, 'always', 'lower-case'],
10-
'subject-case': [
11-
2,
12-
'never',
13-
['sentence-case', 'start-case', 'pascal-case', 'upper-case']
2+
extents: ['@commitlint/config-conventional'],
3+
rules: {
4+
'body-leading-blank': [1, 'always'],
5+
'footer-leading-blank': [1, 'always'],
6+
'header-max-length': [2, 'always', 72],
7+
'scope-case': [2, 'always', 'lower-case'],
8+
'subject-case': [
9+
2,
10+
'never',
11+
['sentence-case', 'start-case', 'pascal-case', 'upper-case'],
12+
],
13+
'subject-full-stop': [2, 'never', '.'],
14+
'type-case': [2, 'always', 'lower-case'],
15+
'type-enum': [
16+
2,
17+
'always',
18+
[
19+
'build',
20+
'chore',
21+
'ci',
22+
'docs',
23+
'feat',
24+
'fix',
25+
'improvement',
26+
'perf',
27+
'refactor',
28+
'revert',
29+
'style',
30+
'test',
1431
],
15-
'subject-full-stop': [2, 'never', '.'],
16-
'type-case': [2, 'always', 'lower-case'],
17-
'type-enum': [
18-
2,
19-
'always',
20-
[
21-
'build',
22-
'chore',
23-
'ci',
24-
'docs',
25-
'feat',
26-
'fix',
27-
'improvement',
28-
'perf',
29-
'refactor',
30-
'revert',
31-
'style',
32-
'test'
33-
]
34-
]
35-
}
36-
}
32+
],
33+
},
34+
};

Diff for: .eslintrc.js

+64-78
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,67 @@
11
module.exports = {
2-
'env': {
3-
'browser': true,
4-
'es6': true
2+
env: {
3+
browser: true,
4+
es6: true,
5+
},
6+
extends: [
7+
'plugin:@typescript-eslint/recommended',
8+
'airbnb-typescript',
9+
'airbnb/hooks',
10+
],
11+
globals: {
12+
Atomics: 'readonly',
13+
SharedArrayBuffer: 'readonly',
14+
},
15+
parser: '@typescript-eslint/parser',
16+
parserOptions: {
17+
ecmaVersion: 6,
18+
sourceType: 'module',
19+
ecmaFeatures: {
20+
modules: true,
521
},
6-
'extends': [
7-
'plugin:@typescript-eslint/recommended',
8-
'airbnb-typescript',
9-
'airbnb/hooks'
10-
],
11-
'globals': {
12-
'Atomics': 'readonly',
13-
'SharedArrayBuffer': 'readonly'
22+
project: './tsconfig.json',
23+
},
24+
plugins: ['@typescript-eslint'],
25+
settings: {
26+
react: {
27+
pragma: 'h',
1428
},
15-
'parser': '@typescript-eslint/parser',
16-
'parserOptions': {
17-
'ecmaVersion': 6,
18-
'sourceType': 'module',
19-
'ecmaFeatures': {
20-
'modules': true
21-
},
22-
'project': './tsconfig.json'
23-
},
24-
'plugins': [
25-
'@typescript-eslint'
26-
],
27-
'settings': {
28-
'react': {
29-
'pragma': 'h'
30-
}
31-
},
32-
'rules': {
33-
'indent': [
34-
'error',
35-
2,
36-
{ "SwitchCase": 1 }
37-
],
38-
'linebreak-style': [
39-
'error',
40-
'unix'
41-
],
42-
'quotes': [
43-
'error',
44-
'single'
45-
],
46-
'semi': [
47-
'error',
48-
'always'
49-
],
50-
'@typescript-eslint/no-var-requires': 0,
51-
'@typescript-eslint/no-use-before-define': 0,
52-
'import/prefer-default-export': 0,
53-
'import/no-cycle': 0,
54-
'no-plusplus': 0,
55-
'no-underscore-dangle': 0,
56-
'no-param-reassign': 0,
57-
'arrow-parens': 0,
58-
'consistent-return': 0,
59-
'import/no-named-as-default': 0,
60-
'class-methods-use-this': 0,
61-
'@typescript-eslint/no-unused-expressions': 0,
62-
'@typescript-eslint/lines-between-class-members': 0,
63-
'@typescript-eslint/no-non-null-assertion': 0,
64-
'@typescript-eslint/explicit-module-boundary-types': 0,
65-
'@typescript-eslint/no-namespace': "off",
66-
'react/prop-types': 0,
67-
'react/jsx-props-no-spreading': 0,
68-
'react/prefer-stateless-function': 0,
69-
'jsx-a11y/click-events-have-key-events': 0,
70-
'jsx-a11y/no-static-element-interactions': 0,
71-
'jsx-a11y/no-noninteractive-element-interactions': 0,
72-
'@typescript-eslint/ban-types': 0,
73-
'max-classes-per-file': 0,
74-
'react/jsx-boolean-value': 0,
75-
'@typescript-eslint/ban-ts-comment': 0,
76-
'react/no-danger': 0,
77-
'no-console': 0,
78-
'import/no-extraneous-dependencies': 0,
79-
"@typescript-eslint/no-explicit-any": 0
80-
}
81-
}
29+
},
30+
rules: {
31+
'indent': ['error', 2, { SwitchCase: 1 }],
32+
'linebreak-style': ['error', 'unix'],
33+
'quotes': ['error', 'single'],
34+
'semi': ['error', 'always'],
35+
'@typescript-eslint/no-var-requires': 0,
36+
'@typescript-eslint/no-use-before-define': 0,
37+
'import/prefer-default-export': 0,
38+
'import/no-cycle': 0,
39+
'no-plusplus': 0,
40+
'no-underscore-dangle': 0,
41+
'no-param-reassign': 0,
42+
'arrow-parens': 0,
43+
'consistent-return': 0,
44+
'import/no-named-as-default': 0,
45+
'class-methods-use-this': 0,
46+
'@typescript-eslint/no-unused-expressions': 0,
47+
'@typescript-eslint/lines-between-class-members': 0,
48+
'@typescript-eslint/no-non-null-assertion': 0,
49+
'@typescript-eslint/explicit-module-boundary-types': 0,
50+
'@typescript-eslint/no-namespace': 'off',
51+
'react/prop-types': 0,
52+
'react/jsx-props-no-spreading': 0,
53+
'react/prefer-stateless-function': 0,
54+
'jsx-a11y/click-events-have-key-events': 0,
55+
'jsx-a11y/no-static-element-interactions': 0,
56+
'jsx-a11y/no-noninteractive-element-interactions': 0,
57+
'@typescript-eslint/ban-types': 0,
58+
'max-classes-per-file': 0,
59+
'react/jsx-boolean-value': 0,
60+
'@typescript-eslint/ban-ts-comment': 0,
61+
'react/no-danger': 0,
62+
'no-console': 0,
63+
'import/no-extraneous-dependencies': 0,
64+
'@typescript-eslint/no-explicit-any': 0,
65+
'object-curly-newline': 0
66+
},
67+
};

Diff for: .prettierrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"tabWidth": 2,
3+
"singleQuote": true,
4+
"semi": true,
5+
"trailingComma": "all"
6+
}

Diff for: package.json

+16-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
{
2-
"name": "LogicFlow",
2+
"name": "logicflow",
33
"private": true,
44
"description": "一款流程可视化的前端框架",
55
"license": "Apache 2.0",
66
"author": "LogicFlow-Team",
7-
"workspaces": ["packages/*", "examples"],
7+
"workspaces": [
8+
"packages/*",
9+
"examples"
10+
],
811
"scripts": {
912
"bootstrap": "yarn",
1013
"clean": "lerna clean",
@@ -17,11 +20,6 @@
1720
"docs:dev": "./node_modules/.bin/vuepress dev docs",
1821
"docs:build": "./node_modules/.bin/vuepress build docs"
1922
},
20-
"husky": {
21-
"hooks": {
22-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
23-
}
24-
},
2523
"dependencies": {},
2624
"devDependencies": {
2725
"@typescript-eslint/eslint-plugin": "^3.6.1",
@@ -36,8 +34,10 @@
3634
"eslint-plugin-react-hooks": "^4.1.2",
3735
"eslint-plugin-standard": "^4.0.1",
3836
"eslint-webpack-plugin": "^2.1.0",
37+
"husky": "^6.0.0",
3938
"inquirer": "^7.3.3",
4039
"lerna": "^3.22.1",
40+
"lint-staged": "^10.5.4",
4141
"shelljs": "^0.8.4",
4242
"typescript": "^3.8.3",
4343
"vuepress": "^1.7.1"
@@ -46,5 +46,14 @@
4646
"commitizen": {
4747
"path": "./node_modules/cz-lerna-changelog"
4848
}
49+
},
50+
"husky": {
51+
"hooks": {
52+
"pre-commit": "npm run lint",
53+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
54+
}
55+
},
56+
"lint-staged": {
57+
"*.{ts,tsx}": "npm run lint"
4958
}
5059
}

Diff for: packages/core/package.json

-6
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,6 @@
8181
"last 2 versions",
8282
"not ie <= 11"
8383
],
84-
"husky": {
85-
"hooks": {
86-
"pre-commit": "tsc -d --noEmit && npm run lint",
87-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
88-
}
89-
},
9084
"config": {
9185
"commitizen": {
9286
"path": "./node_modules/cz-conventional-changelog"

Diff for: packages/extension/babel.config.js

+8-14
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
module.exports = {
22
presets: [
3-
[
4-
'@babel/preset-env', {targets: {node: 'current'}}
5-
],
3+
['@babel/preset-env', { targets: { node: 'current' } }],
64
'@babel/preset-typescript',
75
],
8-
"plugins": [
6+
plugins: [
97
[
10-
"@babel/plugin-transform-react-jsx",
8+
'@babel/plugin-transform-react-jsx',
119
{
12-
"pragma": "h"
13-
}
10+
pragma: 'h',
11+
},
1412
],
15-
[
16-
"@babel/plugin-proposal-class-properties",
17-
{ "loose": true }
18-
],
19-
]
20-
}
21-
13+
['@babel/plugin-proposal-class-properties', { loose: true }],
14+
],
15+
};

Diff for: packages/extension/package.json

-2
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,12 @@
5353
"css-loader": "^4.2.1",
5454
"eslint": "^7.0.0",
5555
"eslint-config-airbnb-typescript": "^9.0.0",
56-
"eslint-loader": "^4.0.2",
5756
"eslint-plugin-import": "^2.22.0",
5857
"eslint-plugin-jsx-a11y": "^6.3.1",
5958
"eslint-plugin-react": "^7.20.6",
6059
"eslint-plugin-standard": "^4.0.1",
6160
"eslint-webpack-plugin": "^2.1.0",
6261
"html-webpack-plugin": "^4.2.0",
63-
"husky": "^4.2.5",
6462
"less-loader": "^6.0.0",
6563
"prettier": "^2.2.1",
6664
"rimraf": "^3.0.2",

Diff for: packages/site/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
"eslint-plugin-standard": "^4.0.1",
4444
"eslint-webpack-plugin": "^2.1.0",
4545
"html-webpack-plugin": "^4.2.0",
46-
"husky": "^4.2.5",
4746
"less-loader": "^6.0.0",
4847
"prettier": "^2.2.1",
4948
"rimraf": "^3.0.2",

0 commit comments

Comments
 (0)