Skip to content

Commit

Permalink
style: set eslint
Browse files Browse the repository at this point in the history
affects: @logicflow/core, @logicflow/extension, site
  • Loading branch information
yhlchao committed Apr 9, 2021
1 parent 7edae48 commit 0a8e1e8
Show file tree
Hide file tree
Showing 9 changed files with 245 additions and 147 deletions.
66 changes: 32 additions & 34 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
module.exports = {
extents:[
"@commitlint/config-conventional"
],
rules:{
'body-leading-blank': [1, 'always'],
'footer-leading-blank': [1, 'always'],
'header-max-length': [2, 'always', 72],
'scope-case': [2, 'always', 'lower-case'],
'subject-case': [
2,
'never',
['sentence-case', 'start-case', 'pascal-case', 'upper-case']
extents: ['@commitlint/config-conventional'],
rules: {
'body-leading-blank': [1, 'always'],
'footer-leading-blank': [1, 'always'],
'header-max-length': [2, 'always', 72],
'scope-case': [2, 'always', 'lower-case'],
'subject-case': [
2,
'never',
['sentence-case', 'start-case', 'pascal-case', 'upper-case'],
],
'subject-full-stop': [2, 'never', '.'],
'type-case': [2, 'always', 'lower-case'],
'type-enum': [
2,
'always',
[
'build',
'chore',
'ci',
'docs',
'feat',
'fix',
'improvement',
'perf',
'refactor',
'revert',
'style',
'test',
],
'subject-full-stop': [2, 'never', '.'],
'type-case': [2, 'always', 'lower-case'],
'type-enum': [
2,
'always',
[
'build',
'chore',
'ci',
'docs',
'feat',
'fix',
'improvement',
'perf',
'refactor',
'revert',
'style',
'test'
]
]
}
}
],
},
};
142 changes: 64 additions & 78 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,81 +1,67 @@
module.exports = {
'env': {
'browser': true,
'es6': true
env: {
browser: true,
es6: true,
},
extends: [
'plugin:@typescript-eslint/recommended',
'airbnb-typescript',
'airbnb/hooks',
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {
modules: true,
},
'extends': [
'plugin:@typescript-eslint/recommended',
'airbnb-typescript',
'airbnb/hooks'
],
'globals': {
'Atomics': 'readonly',
'SharedArrayBuffer': 'readonly'
project: './tsconfig.json',
},
plugins: ['@typescript-eslint'],
settings: {
react: {
pragma: 'h',
},
'parser': '@typescript-eslint/parser',
'parserOptions': {
'ecmaVersion': 6,
'sourceType': 'module',
'ecmaFeatures': {
'modules': true
},
'project': './tsconfig.json'
},
'plugins': [
'@typescript-eslint'
],
'settings': {
'react': {
'pragma': 'h'
}
},
'rules': {
'indent': [
'error',
2,
{ "SwitchCase": 1 }
],
'linebreak-style': [
'error',
'unix'
],
'quotes': [
'error',
'single'
],
'semi': [
'error',
'always'
],
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/no-use-before-define': 0,
'import/prefer-default-export': 0,
'import/no-cycle': 0,
'no-plusplus': 0,
'no-underscore-dangle': 0,
'no-param-reassign': 0,
'arrow-parens': 0,
'consistent-return': 0,
'import/no-named-as-default': 0,
'class-methods-use-this': 0,
'@typescript-eslint/no-unused-expressions': 0,
'@typescript-eslint/lines-between-class-members': 0,
'@typescript-eslint/no-non-null-assertion': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-namespace': "off",
'react/prop-types': 0,
'react/jsx-props-no-spreading': 0,
'react/prefer-stateless-function': 0,
'jsx-a11y/click-events-have-key-events': 0,
'jsx-a11y/no-static-element-interactions': 0,
'jsx-a11y/no-noninteractive-element-interactions': 0,
'@typescript-eslint/ban-types': 0,
'max-classes-per-file': 0,
'react/jsx-boolean-value': 0,
'@typescript-eslint/ban-ts-comment': 0,
'react/no-danger': 0,
'no-console': 0,
'import/no-extraneous-dependencies': 0,
"@typescript-eslint/no-explicit-any": 0
}
}
},
rules: {
'indent': ['error', 2, { SwitchCase: 1 }],
'linebreak-style': ['error', 'unix'],
'quotes': ['error', 'single'],
'semi': ['error', 'always'],
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/no-use-before-define': 0,
'import/prefer-default-export': 0,
'import/no-cycle': 0,
'no-plusplus': 0,
'no-underscore-dangle': 0,
'no-param-reassign': 0,
'arrow-parens': 0,
'consistent-return': 0,
'import/no-named-as-default': 0,
'class-methods-use-this': 0,
'@typescript-eslint/no-unused-expressions': 0,
'@typescript-eslint/lines-between-class-members': 0,
'@typescript-eslint/no-non-null-assertion': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-namespace': 'off',
'react/prop-types': 0,
'react/jsx-props-no-spreading': 0,
'react/prefer-stateless-function': 0,
'jsx-a11y/click-events-have-key-events': 0,
'jsx-a11y/no-static-element-interactions': 0,
'jsx-a11y/no-noninteractive-element-interactions': 0,
'@typescript-eslint/ban-types': 0,
'max-classes-per-file': 0,
'react/jsx-boolean-value': 0,
'@typescript-eslint/ban-ts-comment': 0,
'react/no-danger': 0,
'no-console': 0,
'import/no-extraneous-dependencies': 0,
'@typescript-eslint/no-explicit-any': 0,
'object-curly-newline': 0
},
};
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"tabWidth": 2,
"singleQuote": true,
"semi": true,
"trailingComma": "all"
}
23 changes: 16 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"name": "LogicFlow",
"name": "logicflow",
"private": true,
"description": "一款流程可视化的前端框架",
"license": "Apache 2.0",
"author": "LogicFlow-Team",
"workspaces": ["packages/*", "examples"],
"workspaces": [
"packages/*",
"examples"
],
"scripts": {
"bootstrap": "yarn",
"clean": "lerna clean",
Expand All @@ -17,11 +20,6 @@
"docs:dev": "./node_modules/.bin/vuepress dev docs",
"docs:build": "./node_modules/.bin/vuepress build docs"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"dependencies": {},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^3.6.1",
Expand All @@ -36,8 +34,10 @@
"eslint-plugin-react-hooks": "^4.1.2",
"eslint-plugin-standard": "^4.0.1",
"eslint-webpack-plugin": "^2.1.0",
"husky": "^6.0.0",
"inquirer": "^7.3.3",
"lerna": "^3.22.1",
"lint-staged": "^10.5.4",
"shelljs": "^0.8.4",
"typescript": "^3.8.3",
"vuepress": "^1.7.1"
Expand All @@ -46,5 +46,14 @@
"commitizen": {
"path": "./node_modules/cz-lerna-changelog"
}
},
"husky": {
"hooks": {
"pre-commit": "npm run lint",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"lint-staged": {
"*.{ts,tsx}": "npm run lint"
}
}
6 changes: 0 additions & 6 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,6 @@
"last 2 versions",
"not ie <= 11"
],
"husky": {
"hooks": {
"pre-commit": "tsc -d --noEmit && npm run lint",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
Expand Down
22 changes: 8 additions & 14 deletions packages/extension/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
module.exports = {
presets: [
[
'@babel/preset-env', {targets: {node: 'current'}}
],
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript',
],
"plugins": [
plugins: [
[
"@babel/plugin-transform-react-jsx",
'@babel/plugin-transform-react-jsx',
{
"pragma": "h"
}
pragma: 'h',
},
],
[
"@babel/plugin-proposal-class-properties",
{ "loose": true }
],
]
}

['@babel/plugin-proposal-class-properties', { loose: true }],
],
};
2 changes: 0 additions & 2 deletions packages/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,12 @@
"css-loader": "^4.2.1",
"eslint": "^7.0.0",
"eslint-config-airbnb-typescript": "^9.0.0",
"eslint-loader": "^4.0.2",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-standard": "^4.0.1",
"eslint-webpack-plugin": "^2.1.0",
"html-webpack-plugin": "^4.2.0",
"husky": "^4.2.5",
"less-loader": "^6.0.0",
"prettier": "^2.2.1",
"rimraf": "^3.0.2",
Expand Down
1 change: 0 additions & 1 deletion packages/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"eslint-plugin-standard": "^4.0.1",
"eslint-webpack-plugin": "^2.1.0",
"html-webpack-plugin": "^4.2.0",
"husky": "^4.2.5",
"less-loader": "^6.0.0",
"prettier": "^2.2.1",
"rimraf": "^3.0.2",
Expand Down
Loading

0 comments on commit 0a8e1e8

Please sign in to comment.