From f11ead084aed63f40b2ce8c6d750405c6c6f47d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=84=B6=E5=88=99?= Date: Mon, 14 May 2018 18:20:20 +0800 Subject: [PATCH] test: fix lint, close #2295 --- .eslintignore | 7 ++++++- .eslintrc.js | 10 ++++------ package.json | 4 ++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.eslintignore b/.eslintignore index 40b878db5b..bb7762f79f 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1,6 @@ -node_modules/ \ No newline at end of file +components/**/*.js +components/**/*.jsx +components/*/__tests__/type.tsx +!.eslintrc.js +!components/*/__tests__/**/*.js +!components/*/demo/* diff --git a/.eslintrc.js b/.eslintrc.js index 5f7bc5b083..589cbf0f61 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,5 +1,3 @@ -'use strict'; - const eslintrc = { extends: ['eslint-config-airbnb'], env: { @@ -21,7 +19,7 @@ const eslintrc = { 'markdown', 'react', 'babel', - 'jsx-a11y' + 'jsx-a11y', ], rules: { 'class-methods-use-this': 0, @@ -39,7 +37,7 @@ const eslintrc = { 'import/extensions': 0, 'import/no-extraneous-dependencies': 0, 'react/no-string-refs': 0, - "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx", ".tsx", ".md"] }], + 'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx', '.tsx', '.md'] }], 'react/no-array-index-key': 0, 'react/no-find-dom-node': 0, 'react/require-extension': 0, @@ -51,7 +49,7 @@ const eslintrc = { 'jsx-a11y/anchor-is-valid': 0, 'react/jsx-no-comment-textnodes': 0, 'object-curly-newline': 0, - } + }, }; if (process.env.RUN_ENV === 'DEMO') { @@ -62,7 +60,7 @@ if (process.env.RUN_ENV === 'DEMO') { AlipayJSBridge: true, $: true, dd: true, - process: true + process: true, }; Object.assign(eslintrc.rules, { diff --git a/package.json b/package.json index 3cced31ad9..b111cb1711 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "jest": "^21.0.0", "jsonml.js": "^0.1.0", "lesshint": "^4.0.2", - "lint-staged": "^4.0.2", + "lint-staged": "^7.0.0", "lodash.debounce": "^4.0.6", "mockdate": "^2.0.1", "pre-commit": "1.x", @@ -178,7 +178,7 @@ "{tests,site,scripts,components}/**/*.{js,jsx}": [ "lint-staged:es" ], - "{site,components}/**/*.less": "stylelint", + "{site,components}/**/*.less": "stylelint --syntax less", "components/*/demo/*.md": [ "lint-staged:demo" ]