Skip to content

Commit

Permalink
Merge pull request #921 from nervosnetwork/eslint-per-package
Browse files Browse the repository at this point in the history
chore(lint): Each package manages its own eslint configuration
  • Loading branch information
ashchan authored Sep 10, 2019
2 parents 919099b + 8e5abaf commit d4db2ac
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 33 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

7 changes: 0 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,10 @@
"concurrently": "4.1.2",
"cross-env": "5.2.1",
"eslint": "6.3.0",
"eslint-config-airbnb": "18.0.1",
"eslint-config-prettier": "6.2.0",
"eslint-plugin-import": "2.18.2",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-prettier": "3.1.0",
"eslint-plugin-react": "7.14.3",
"husky": "3.0.5",
"lerna": "3.16.4",
"ncp": "2.0.0",
"nodemon": "1.19.2",
"prettier": "1.18.2",
"ts-jest": "24.0.2",
"typescript": "3.6.2",
"wait-on": "3.3.0"
Expand Down
72 changes: 68 additions & 4 deletions packages/neuron-ui/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,69 @@
module.exports = {
"extends": [
"../../.eslintrc.js"
],
"extends": ["airbnb", "plugin:prettier/recommended"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"settings": {
"import/resolver": {
"node": {
"paths": ["src"],
"extensions": [".js", ".ts", ".jsx", ".tsx"]
}
},
"react": {
"version": "detect"
}
},
"rules": {
"prettier/prettier": [2, {
"printWidth": 120
}],
"semi": [2, "never"],
"curly": [2, "all"],
"comma-dangle": [2, {
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "ignore"
}],
"import/no-extraneous-dependencies": [2, {
"devDependencies": true
}],
"no-unused-vars": "off",
"implicit-arrow-linebreak": "off",
"@typescript-eslint/no-unused-vars": ["error", {
"vars": "local",
"args": "after-used",
"ignoreRestSiblings": false
}],
"arrow-parens": [2, "as-needed"],
"max-len": [2, {
"code": 120,
"ignoreComments": true,
"ignoreTrailingComments": true,
"ignoreUrls": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreRegExpLiterals": true,
}],
"object-curly-newline": ["error", {
"ObjectExpression": {
"consistent": true
},
"ObjectPattern": {
"consistent": true
},
"ImportDeclaration": {
"consistent": true,
},
"ExportDeclaration": {
"multiline": true,
"minProperties": 3
}
}],
"no-plusplus": [0],
"lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
"max-classes-per-file": [0],
"react/jsx-filename-extension": [1, {
"extensions": [".ts", ".tsx"]
}],
Expand All @@ -17,5 +73,13 @@ module.exports = {
"no-console": [2, {
"allow": ["info", "warn", "error", "group", "groupEnd"]
}]
}
},
"env": {
"jest": true,
"node": true,
"browser": true
},
"globals": {
"BigInt": "readonly"
},
}
File renamed without changes.
7 changes: 7 additions & 0 deletions packages/neuron-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,17 @@
"babel-jest": "24.9.0",
"enzyme": "3.10.0",
"enzyme-adapter-react-16": "1.14.0",
"eslint-config-airbnb": "18.0.1",
"eslint-config-prettier": "6.2.0",
"eslint-plugin-import": "2.18.2",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-prettier": "3.1.0",
"eslint-plugin-react": "7.14.3",
"jest-styled-components": "7.0.0-beta.1",
"jsqr": "1.2.0",
"lint-staged": "9.2.5",
"node-sass": "4.12.0",
"prettier": "1.18.2",
"react-app-rewired": "2.1.3",
"react-test-renderer": "16.9.0",
"rimraf": "3.0.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/neuron-ui/src/utils/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useState, useCallback } from 'react'
import { updateTransactionDescription, updateAddressDescription } from 'states/stateProvider/actionCreators'
import { StateDispatch } from 'states/stateProvider/reducer'
import { AppActions } from 'states/stateProvider/reducer'
import { StateDispatch, AppActions } from 'states/stateProvider/reducer'

export const useGoBack = (history: any) => {
return useCallback(() => {
Expand Down
42 changes: 23 additions & 19 deletions .eslintrc.js → packages/neuron-wallet/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
module.exports = {
"extends": ["airbnb", "plugin:prettier/recommended"],
"extends": "eslint:recommended",
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": {
"prettier/prettier": [2, {
"printWidth": 120
"no-console": 0,
"no-cond-assign": 0,
"no-extra-semi": "warn",
"semi": 0,
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", {
"vars": "local",
"args": "after-used",
"ignoreRestSiblings": false
}],
"semi": [2, "never"],
"curly": [2, "all"],
"comma-dangle": [2, {
"arrays": "always-multiline",
Expand All @@ -15,16 +24,7 @@ module.exports = {
"exports": "always-multiline",
"functions": "ignore"
}],
"import/no-extraneous-dependencies": [2, {
"devDependencies": true
}],
"no-unused-vars": "off",
"implicit-arrow-linebreak": "off",
"@typescript-eslint/no-unused-vars": ["error", {
"vars": "local",
"args": "after-used",
"ignoreRestSiblings": false
}],
"arrow-parens": [2, "as-needed"],
"max-len": [2, {
"code": 120,
Expand All @@ -51,25 +51,29 @@ module.exports = {
}
}],
"no-plusplus": [0],
"lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
"max-classes-per-file": [0],
"@typescript-eslint/no-angle-bracket-type-assertion": [0],
"no-alert": [0],
"no-console": [2, {
"allow": ["warn", "error", "info"]
"allow": ["info", "warn", "error", "group", "groupEnd"]
}],
"lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
"max-classes-per-file": [0]
"require-atomic-updates": [0]
},
"globals": {
"BigInt": "readonly"
},
"env": {
"jest": true,
"es6": true,
"node": true,
"browser": true,
"node": true
"jest": true
},
"settings": {
"import/resolver": {
"node": {
"paths": ["src"],
"extensions": [".js", ".jsx", ".ts", ".tsx"]
"extensions": [".js", ".ts"]
}
}
}
Expand Down

0 comments on commit d4db2ac

Please sign in to comment.