Skip to content

Commit

Permalink
Merge pull request #5 from ice-lab/fix-plugin-not-exist
Browse files Browse the repository at this point in the history
Fix plugin not exist
  • Loading branch information
Orange-C authored Jul 9, 2019
2 parents f8babd1 + 6907606 commit 357cd2f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 16 deletions.
19 changes: 13 additions & 6 deletions lib/eslint.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
root: true,
parser: "babel-eslint",
parser: require.resolve('babel-eslint'),
parserOptions: {
ecmaVersion: 2018,
ecmaFeatures: {
Expand All @@ -9,12 +9,13 @@ module.exports = {
},
extends: [
/** Airbnb JavaScript Style Guide https://github.com/airbnb/javascript#types */
"airbnb",
"prettier",
"prettier/react"
// Airbnb include react, react-a11y(include jsx-a11y)
require.resolve('eslint-config-airbnb'),
require.resolve('eslint-config-prettier'),
require.resolve('eslint-config-prettier/react'),
],
plugins: [
"react-hooks"
'react-hooks'
],
env: {
es6: true,
Expand All @@ -37,6 +38,8 @@ module.exports = {
"jsx-a11y/click-events-have-key-events": 0,
// 禁止不规则使用 a 标签:取消
"jsx-a11y/anchor-is-valid": 0,
// require that JSX labels use "htmlFor": 警告
"jsx-a11y/label-has-for": 1,

/** react相关 https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules */
// index 不能作为 key:取消
Expand Down Expand Up @@ -101,7 +104,11 @@ module.exports = {
"no-restricted-globals": 0,
// 禁止 if 语句中 return 语句之后有 else 块:取消
"no-else-return": 0,
// 禁止在 return 语句中使用赋值语句:取消 TBD ref={formRef => form = formRef}
"no-return-assign": 0,
// 禁止在return语句中使用await:取消
"no-return-await": 0
"no-return-await": 0,
// 禁止 ++ --: 取消
"no-plusplus": 0,
}
}
6 changes: 4 additions & 2 deletions lib/eslintTS.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ const eslint = require('./eslint');
const deepmerge = require('deepmerge')

const TSConfig = {
parser: "@typescript-eslint/parser",
extends: ["plugin:@typescript-eslint/recommended"],
parser: require.resolve("@typescript-eslint/parser"),
extends: [
"plugin:@typescript-eslint/recommended"
],
plugins: ["@typescript-eslint"],
rules: {
// 数组类型始终使用[]格式声明
Expand Down
10 changes: 5 additions & 5 deletions lib/stylelint.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module.exports = {
extends: [
"stylelint-config-standard",
"stylelint-config-css-modules",
"stylelint-scss",
"stylelint-config-rational-order",
"stylelint-config-prettier",
require.resolve("stylelint-config-standard"),
require.resolve("stylelint-config-css-modules"),
require.resolve("stylelint-scss"),
require.resolve("stylelint-config-rational-order"),
require.resolve("stylelint-config-prettier"),
],
plugins: [
"stylelint-order",
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ice/spec",
"version": "0.1.4-beta.1",
"version": "0.1.4",
"description": "eslint/stylelint/editorconfig",
"main": "lib/index.js",
"scripts": {
Expand All @@ -20,7 +20,7 @@
"homepage": "https://github.com/ice-lab/spec#readme",
"peerDependencies": {
"typescript": "^3.0.0",
"eslint": "^5.0.0",
"eslint": ">=5.0.0",
"stylelint": "^10.0.0"
},
"dependencies": {
Expand All @@ -30,7 +30,6 @@
"deepmerge": "^3.3.0",
"eslint-config-airbnb": "^17.1.1",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-import": "^2.18.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.14.2",
Expand All @@ -41,5 +40,8 @@
"stylelint-config-standard": "^18.3.0",
"stylelint-order": "^3.0.0",
"stylelint-scss": "^3.8.0"
},
"devDependencies": {
"typescript": "^3.5.3"
}
}

0 comments on commit 357cd2f

Please sign in to comment.