Skip to content

Commit

Permalink
chore: move out eslint stylelint commitlint config
Browse files Browse the repository at this point in the history
  • Loading branch information
Garfield550 committed Apr 5, 2020
1 parent 5737848 commit 4cbbc72
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 171 deletions.
105 changes: 105 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"extends": [
"o2team",
"plugin:react/recommended",
"plugin:prettier/recommended"
],
"parser": "babel-eslint",
"plugins": [
"react"
],
"env": {
"jest": true
},
"rules": {
"class-methods-use-this": "off",
"prefer-rest-params": "off",
"arrow-body-style": "warn",
"taro/custom-component-children": "off",
"no-unused-vars": [
"error",
{
"varsIgnorePattern": "React"
}
],
"no-console": [
"error",
{
"allow": [
"warn",
"error"
]
}
]
},
"overrides": [
{
"files": [
"build/*.js"
],
"rules": {
"import/no-commonjs": "off"
}
},
{
"files": [
"test/**/*.test.js",
"test/**/test.js"
],
"rules": {
"taro/no-stateless-component": "off",
"react/react-in-jsx-scope": "off",
"react/no-find-dom-node": "off",
"no-unused-vars": [
"error",
{
"varsIgnorePattern": "Nerv"
}
]
}
},
{
"files": [
"**/*.ts",
"**/*.tsx"
],
"parser": "@typescript-eslint/parser",
"plugins": [
"react",
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:prettier/recommended"
],
"env": {
"jest": true
},
"rules": {
"@typescript-eslint/no-explicit-any": [
"off"
],
"@typescript-eslint/member-delimiter-style": [
"off"
],
"class-methods-use-this": "off",
"prefer-rest-params": "off",
"arrow-body-style": "warn",
"react/jsx-filename-extension": [
2,
{
"extensions": [
".js",
".jsx",
".ts",
".tsx"
]
}
]
}
}
]
}
17 changes: 17 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "stylelint-config-standard",
"plugins": [
"stylelint-scss"
],
"rules": {
"declaration-colon-newline-after": null,
"at-rule-no-unknown": null,
"color-hex-case": null,
"block-closing-brace-newline-after": null,
"at-rule-empty-line-before": null,
"number-no-trailing-zeros": null,
"no-empty-source": null,
"unit-case": null,
"scss/at-rule-no-unknown": true
}
}
13 changes: 13 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-empty': [2, 'never'],
'type-case': [2, 'always', 'lower-case'],
'subject-empty': [2, 'never'],
'type-enum': [
2,
'always',
['feat', 'fix', 'docs', 'style', 'refactor', 'test', 'chore']
]
}
}
171 changes: 0 additions & 171 deletions packages/taro-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,177 +28,6 @@
"url": "[email protected]:nervjs/taro-ui.git"
},
"license": "MIT",
"eslintConfig": {
"extends": [
"o2team",
"plugin:react/recommended",
"plugin:prettier/recommended"
],
"parser": "babel-eslint",
"plugins": [
"react"
],
"env": {
"jest": true
},
"rules": {
"class-methods-use-this": "off",
"prefer-rest-params": "off",
"arrow-body-style": "warn",
"taro/custom-component-children": "off",
"no-unused-vars": [
"error",
{
"varsIgnorePattern": "React"
}
],
"no-console": [
"error",
{
"allow": [
"warn",
"error"
]
}
]
},
"overrides": [
{
"files": [
"build/*.js"
],
"rules": {
"import/no-commonjs": "off"
}
},
{
"files": [
"test/**/*.test.js",
"test/**/test.js"
],
"rules": {
"taro/no-stateless-component": "off",
"react/react-in-jsx-scope": "off",
"react/no-find-dom-node": "off",
"no-unused-vars": [
"error",
{
"varsIgnorePattern": "Nerv"
}
]
}
},
{
"files": [
"**/*.ts",
"**/*.tsx"
],
"parser": "@typescript-eslint/parser",
"plugins": [
"react",
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:prettier/recommended"
],
"env": {
"jest": true
},
"rules": {
"@typescript-eslint/no-explicit-any": [
"off"
],
"@typescript-eslint/member-delimiter-style": [
"off"
],
"class-methods-use-this": "off",
"prefer-rest-params": "off",
"arrow-body-style": "warn",
"react/jsx-filename-extension": [
2,
{
"extensions": [
".js",
".jsx",
".ts",
".tsx"
]
}
]
}
}
]
},
"stylelint": {
"extends": "stylelint-config-standard",
"plugins": [
"stylelint-scss"
],
"rules": {
"declaration-colon-newline-after": null,
"at-rule-no-unknown": null,
"color-hex-case": null,
"block-closing-brace-newline-after": null,
"at-rule-empty-line-before": null,
"number-no-trailing-zeros": null,
"no-empty-source": null,
"unit-case": null,
"scss/at-rule-no-unknown": true
}
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
],
"rules": {
"type-empty": [
2,
"never"
],
"type-case": [
2,
"always",
"lower-case"
],
"subject-empty": [
2,
"never"
],
"type-enum": [
2,
"always",
[
"feat",
"fix",
"docs",
"style",
"refactor",
"test",
"chore"
]
]
}
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"eslint --quiet --cache --fix",
"git add"
],
"src/**/*.scss": [
"stylelint --syntax scss --fix",
"git add"
]
},
"scripts": {
"dev:weapp": "yarn run build:weapp -- --watch",
"dev:qq": "yarn run build:qq -- --watch",
Expand Down

0 comments on commit 4cbbc72

Please sign in to comment.