Skip to content

Commit

Permalink
build: add some eslint and stylelint plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
tjx666 committed Mar 6, 2020
1 parent 5a379f0 commit 2ca9abd
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 6 deletions.
22 changes: 21 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ module.exports = {
'plugin:import/typescript',
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:unicorn/recommended',
'plugin:promise/recommended',
'prettier',
'prettier/react',
'prettier/@typescript-eslint',
Expand All @@ -42,7 +44,7 @@ module.exports = {
},
},
},
plugins: ['react', '@typescript-eslint'],
plugins: ['react', '@typescript-eslint', 'unicorn', 'promise'],
rules: {
'eslint-comments/disable-enable-pair': [ERROR, { allowWholeFile: true }],

Expand All @@ -57,6 +59,24 @@ module.exports = {
},
],

'unicorn/prevent-abbreviations': OFF,
'unicorn/filename-case': [
'error',
{
cases: {
// 中划线
kebabCase: false,
// 小驼峰
camelCase: true,
// 下划线
snakeCase: false,
// 大驼峰
pascalCase: true,
},
},
],
'unicorn/no-process-exit': OFF,

'@typescript-eslint/explicit-function-return-type': OFF,
'@typescript-eslint/no-explicit-any': OFF,
'@typescript-eslint/no-non-null-assertion': OFF,
Expand Down
12 changes: 10 additions & 2 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"extends": ["stylelint-config-standard", "stylelint-config-rational-order", "stylelint-config-prettier"],
"plugins": ["stylelint-order", "stylelint-declaration-block-no-ignored-properties"],
"extends": [
"stylelint-config-standard",
"stylelint-config-rational-order",
"stylelint-config-prettier"
],
"plugins": [
"stylelint-order",
"stylelint-declaration-block-no-ignored-properties",
"stylelint-scss"
],
"rules": {
"comment-empty-line-before": null,
"declaration-empty-line-before": null,
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,10 @@
"eslint-plugin-eslint-comments": "^3.1.2",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.18.3",
"eslint-plugin-react-hooks": "^2.5.0",
"eslint-plugin-unicorn": "^16.1.1",
"express": "^4.17.1",
"fork-ts-checker-webpack-plugin": "^4.0.5",
"friendly-errors-webpack-plugin": "^1.7.0",
Expand Down Expand Up @@ -145,6 +147,7 @@
"stylelint-config-standard": "^20.0.0",
"stylelint-declaration-block-no-ignored-properties": "^2.3.0",
"stylelint-order": "^4.0.0",
"stylelint-scss": "^3.14.2",
"terser-webpack-plugin": "^2.3.5",
"ts-node": "^8.6.2",
"typescript": "^3.8.3",
Expand Down
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ ReactDOM.render(
<BrowserRouter>
<App />
</BrowserRouter>,
document.getElementById('root'),
document.querySelector('#root'),
);
133 changes: 131 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2622,6 +2622,13 @@ clean-css@4.2.x:
dependencies:
source-map "~0.6.0"

clean-regexp@^1.0.0:
version "1.0.0"
resolved "https://registry.npm.taobao.org/clean-regexp/download/clean-regexp-1.0.0.tgz#8df7c7aae51fd36874e8f8d05b9180bc11a3fed7"
integrity sha1-jffHquUf02h06PjQW5GAvBGj/tc=
dependencies:
escape-string-regexp "^1.0.5"

clean-stack@^2.0.0:
version "2.2.0"
resolved "https://registry.npm.taobao.org/clean-stack/download/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b"
Expand Down Expand Up @@ -3914,6 +3921,14 @@ escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
resolved "https://registry.npm.taobao.org/escape-string-regexp/download/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=

eslint-ast-utils@^1.1.0:
version "1.1.0"
resolved "https://registry.npm.taobao.org/eslint-ast-utils/download/eslint-ast-utils-1.1.0.tgz#3d58ba557801cfb1c941d68131ee9f8c34bd1586"
integrity sha1-PVi6VXgBz7HJQdaBMe6fjDS9FYY=
dependencies:
lodash.get "^4.4.2"
lodash.zip "^4.2.0"

eslint-config-airbnb-base@^14.0.0:
version "14.0.0"
resolved "https://registry.npm.taobao.org/eslint-config-airbnb-base/download/eslint-config-airbnb-base-14.0.0.tgz#8a7bcb9643d13c55df4dd7444f138bf4efa61e17"
Expand Down Expand Up @@ -4007,6 +4022,11 @@ eslint-plugin-jsx-a11y@^6.2.3:
has "^1.0.3"
jsx-ast-utils "^2.2.1"

eslint-plugin-promise@^4.2.1:
version "4.2.1"
resolved "https://registry.npm.taobao.org/eslint-plugin-promise/download/eslint-plugin-promise-4.2.1.tgz#845fd8b2260ad8f82564c1222fce44ad71d9418a"
integrity sha1-hF/YsiYK2PglZMEiL85ErXHZQYo=

eslint-plugin-react-hooks@^2.5.0:
version "2.5.0"
resolved "https://registry.npm.taobao.org/eslint-plugin-react-hooks/download/eslint-plugin-react-hooks-2.5.0.tgz#c50ab7ca5945ce6d1cf8248d9e185c80b54171b6"
Expand All @@ -4028,6 +4048,28 @@ eslint-plugin-react@^7.18.3:
resolve "^1.14.2"
string.prototype.matchall "^4.0.2"

eslint-plugin-unicorn@^16.1.1:
version "16.1.1"
resolved "https://registry.npm.taobao.org/eslint-plugin-unicorn/download/eslint-plugin-unicorn-16.1.1.tgz#012c598d71914ef30f5d386dd85110e59f2ef999"
integrity sha1-ASxZjXGRTvMPXTht2FEQ5Z8u+Zk=
dependencies:
ci-info "^2.0.0"
clean-regexp "^1.0.0"
eslint-ast-utils "^1.1.0"
eslint-template-visitor "^1.1.0"
import-modules "^2.0.0"
lodash.camelcase "^4.3.0"
lodash.defaultsdeep "^4.6.1"
lodash.kebabcase "^4.1.1"
lodash.snakecase "^4.1.1"
lodash.upperfirst "^4.3.1"
read-pkg-up "^7.0.1"
regexp-tree "^0.1.17"
regexpp "^3.0.0"
reserved-words "^0.1.2"
safe-regex "^2.1.1"
semver "^7.1.2"

eslint-scope@^4.0.3:
version "4.0.3"
resolved "https://registry.npm.taobao.org/eslint-scope/download/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848"
Expand All @@ -4044,6 +4086,15 @@ eslint-scope@^5.0.0:
esrecurse "^4.1.0"
estraverse "^4.1.1"

eslint-template-visitor@^1.1.0:
version "1.1.0"
resolved "https://registry.npm.taobao.org/eslint-template-visitor/download/eslint-template-visitor-1.1.0.tgz#f090d124d1a52e05552149fc50468ed59608b166"
integrity sha1-8JDRJNGlLgVVIUn8UEaO1ZYIsWY=
dependencies:
eslint-visitor-keys "^1.1.0"
espree "^6.1.1"
multimap "^1.0.2"

eslint-utils@^1.4.3:
version "1.4.3"
resolved "https://registry.npm.taobao.org/eslint-utils/download/eslint-utils-1.4.3.tgz#74fec7c54d0776b6f67e0251040b5806564e981f"
Expand Down Expand Up @@ -4099,7 +4150,7 @@ eslint@^6.8.0:
text-table "^0.2.0"
v8-compile-cache "^2.0.3"

espree@^6.1.2:
espree@^6.1.1, espree@^6.1.2:
version "6.2.0"
resolved "https://registry.npm.taobao.org/espree/download/espree-6.2.0.tgz?cache=0&sync_timestamp=1583168748616&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fespree%2Fdownload%2Fespree-6.2.0.tgz#349fef01a202bbab047748300deb37fa44da79d7"
integrity sha1-NJ/vAaICu6sEd0gwDes3+kTaedc=
Expand Down Expand Up @@ -5389,6 +5440,11 @@ import-lazy@^4.0.0:
resolved "https://registry.npm.taobao.org/import-lazy/download/import-lazy-4.0.0.tgz#e8eb627483a0a43da3c03f3e35548be5cb0cc153"
integrity sha1-6OtidIOgpD2jwD8+NVSL5csMwVM=

import-modules@^2.0.0:
version "2.0.0"
resolved "https://registry.npm.taobao.org/import-modules/download/import-modules-2.0.0.tgz#9c1e13b4e7a15682f70a6e3fa29534e4540cfc5d"
integrity sha1-nB4TtOehVoL3Cm4/opU05FQM/F0=

imurmurhash@^0.1.4:
version "0.1.4"
resolved "https://registry.npm.taobao.org/imurmurhash/download/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
Expand Down Expand Up @@ -6261,16 +6317,41 @@ lodash._reinterpolate@^3.0.0:
resolved "https://registry.npm.taobao.org/lodash._reinterpolate/download/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=

lodash.camelcase@^4.3.0:
version "4.3.0"
resolved "https://registry.npm.taobao.org/lodash.camelcase/download/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6"
integrity sha1-soqmKIorn8ZRA1x3EfZathkDMaY=

lodash.defaultsdeep@^4.6.1:
version "4.6.1"
resolved "https://registry.npm.taobao.org/lodash.defaultsdeep/download/lodash.defaultsdeep-4.6.1.tgz#512e9bd721d272d94e3d3a63653fa17516741ca6"
integrity sha1-US6b1yHSctlOPTpjZT+hdRZ0HKY=

lodash.get@^4.4.2:
version "4.4.2"
resolved "https://registry.npm.taobao.org/lodash.get/download/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"
integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=

lodash.ismatch@^4.4.0:
version "4.4.0"
resolved "https://registry.npm.taobao.org/lodash.ismatch/download/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37"
integrity sha1-dWy1FQyjum8RCFp4hJZF8Yj4Xzc=

lodash.kebabcase@^4.1.1:
version "4.1.1"
resolved "https://registry.npm.taobao.org/lodash.kebabcase/download/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36"
integrity sha1-hImxyw0p/4gZXM7KRI/21swpXDY=

lodash.memoize@^4.1.2:
version "4.1.2"
resolved "https://registry.npm.taobao.org/lodash.memoize/download/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"
integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=

lodash.snakecase@^4.1.1:
version "4.1.1"
resolved "https://registry.npm.taobao.org/lodash.snakecase/download/lodash.snakecase-4.1.1.tgz#39d714a35357147837aefd64b5dcbb16becd8f8d"
integrity sha1-OdcUo1NXFHg3rv1ktdy7Fr7Nj40=

lodash.template@^4.0.2, lodash.template@^4.5.0:
version "4.5.0"
resolved "https://registry.npm.taobao.org/lodash.template/download/lodash.template-4.5.0.tgz#f976195cf3f347d0d5f52483569fe8031ccce8ab"
Expand All @@ -6291,6 +6372,16 @@ lodash.uniq@^4.5.0:
resolved "https://registry.npm.taobao.org/lodash.uniq/download/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=

lodash.upperfirst@^4.3.1:
version "4.3.1"
resolved "https://registry.npm.taobao.org/lodash.upperfirst/download/lodash.upperfirst-4.3.1.tgz#1365edf431480481ef0d1c68957a5ed99d49f7ce"
integrity sha1-E2Xt9DFIBIHvDRxolXpe2Z1J984=

lodash.zip@^4.2.0:
version "4.2.0"
resolved "https://registry.npm.taobao.org/lodash.zip/download/lodash.zip-4.2.0.tgz#ec6662e4896408ed4ab6c542a3990b72cc080020"
integrity sha1-7GZi5IlkCO1KtsVCo5kLcswIACA=

lodash@4.17.15, lodash@^4.0.0, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@~4.17.12:
version "4.17.15"
resolved "https://registry.npm.taobao.org/lodash/download/lodash-4.17.15.tgz?cache=0&sync_timestamp=1571657272199&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
Expand Down Expand Up @@ -6838,6 +6929,11 @@ ms@^2.1.1:
resolved "https://registry.npm.taobao.org/ms/download/ms-2.1.2.tgz?cache=0&sync_timestamp=1575472461218&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fms%2Fdownload%2Fms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=

multimap@^1.0.2:
version "1.1.0"
resolved "https://registry.npm.taobao.org/multimap/download/multimap-1.1.0.tgz#5263febc085a1791c33b59bb3afc6a76a2a10ca8"
integrity sha1-UmP+vAhaF5HDO1m7OvxqdqKhDKg=

mute-stream@0.0.8:
version "0.0.8"
resolved "https://registry.npm.taobao.org/mute-stream/download/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d"
Expand Down Expand Up @@ -8696,7 +8792,7 @@ read-pkg-up@^3.0.0:
find-up "^2.0.0"
read-pkg "^3.0.0"

read-pkg-up@^7.0.0:
read-pkg-up@^7.0.0, read-pkg-up@^7.0.1:
version "7.0.1"
resolved "https://registry.npm.taobao.org/read-pkg-up/download/read-pkg-up-7.0.1.tgz?cache=0&sync_timestamp=1575620685999&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fread-pkg-up%2Fdownload%2Fread-pkg-up-7.0.1.tgz#f3a6135758459733ae2b95638056e1854e7ef507"
integrity sha1-86YTV1hFlzOuK5VjgFbhhU5+9Qc=
Expand Down Expand Up @@ -8845,6 +8941,11 @@ regex-not@^1.0.0, regex-not@^1.0.2:
extend-shallow "^3.0.2"
safe-regex "^1.1.0"

regexp-tree@^0.1.17, regexp-tree@~0.1.1:
version "0.1.20"
resolved "https://registry.npm.taobao.org/regexp-tree/download/regexp-tree-0.1.20.tgz?cache=0&sync_timestamp=1582202711719&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fregexp-tree%2Fdownload%2Fregexp-tree-0.1.20.tgz#d4ca65e4ab9ab05262acfce674dadd02d0fb9808"
integrity sha1-1Mpl5KuasFJirPzmdNrdAtD7mAg=

regexp.prototype.flags@^1.3.0:
version "1.3.0"
resolved "https://registry.npm.taobao.org/regexp.prototype.flags/download/regexp.prototype.flags-1.3.0.tgz?cache=0&sync_timestamp=1576388141321&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fregexp.prototype.flags%2Fdownload%2Fregexp.prototype.flags-1.3.0.tgz#7aba89b3c13a64509dabcf3ca8d9fbb9bdf5cb75"
Expand Down Expand Up @@ -9026,6 +9127,11 @@ requires-port@^1.0.0:
resolved "https://registry.npm.taobao.org/requires-port/download/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=

reserved-words@^0.1.2:
version "0.1.2"
resolved "https://registry.npm.taobao.org/reserved-words/download/reserved-words-0.1.2.tgz#00a0940f98cd501aeaaac316411d9adc52b31ab1"
integrity sha1-AKCUD5jNUBrqqsMWQR2a3FKzGrE=

resolve-from@5.0.0, resolve-from@^5.0.0:
version "5.0.0"
resolved "https://registry.npm.taobao.org/resolve-from/download/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69"
Expand Down Expand Up @@ -9166,6 +9272,13 @@ safe-regex@^1.1.0:
dependencies:
ret "~0.1.10"

safe-regex@^2.1.1:
version "2.1.1"
resolved "https://registry.npm.taobao.org/safe-regex/download/safe-regex-2.1.1.tgz#f7128f00d056e2fe5c11e81a1324dd974aadced2"
integrity sha1-9xKPANBW4v5cEegaEyTdl0qtztI=
dependencies:
regexp-tree "~0.1.1"

"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0:
version "2.1.2"
resolved "https://registry.npm.taobao.org/safer-buffer/download/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
Expand Down Expand Up @@ -9268,6 +9381,11 @@ semver@7.0.0:
resolved "https://registry.npm.taobao.org/semver/download/semver-7.0.0.tgz?cache=0&sync_timestamp=1581458063470&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e"
integrity sha1-XzyjV2HkfgWyBsba/yz4FPAxa44=

semver@^7.1.2:
version "7.1.3"
resolved "https://registry.npm.taobao.org/semver/download/semver-7.1.3.tgz?cache=0&sync_timestamp=1581458063470&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-7.1.3.tgz#e4345ce73071c53f336445cfc19efb1c311df2a6"
integrity sha1-5DRc5zBxxT8zZEXPwZ77HDEd8qY=

semver@~5.3.0:
version "5.3.0"
resolved "https://registry.npm.taobao.org/semver/download/semver-5.3.0.tgz?cache=0&sync_timestamp=1581458063470&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsemver%2Fdownload%2Fsemver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
Expand Down Expand Up @@ -9968,6 +10086,17 @@ stylelint-order@^4.0.0:
postcss "^7.0.26"
postcss-sorting "^5.0.1"

stylelint-scss@^3.14.2:
version "3.14.2"
resolved "https://registry.npm.taobao.org/stylelint-scss/download/stylelint-scss-3.14.2.tgz?cache=0&sync_timestamp=1580215251482&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstylelint-scss%2Fdownload%2Fstylelint-scss-3.14.2.tgz#e449a47e0ac410e6909f1a71b49550202c978bf9"
integrity sha1-5EmkfgrEEOaQnxpxtJVQICyXi/k=
dependencies:
lodash "^4.17.15"
postcss-media-query-parser "^0.2.3"
postcss-resolve-nested-selector "^0.1.1"
postcss-selector-parser "^6.0.2"
postcss-value-parser "^4.0.2"

stylelint@^13.2.0:
version "13.2.0"
resolved "https://registry.npm.taobao.org/stylelint/download/stylelint-13.2.0.tgz#b6f5b67b9a9a51f1fd105ab916952456d93826b4"
Expand Down

0 comments on commit 2ca9abd

Please sign in to comment.