Skip to content

Commit

Permalink
chore: 🛠️ use "@antv/eslint-config" with eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
bubkoo committed Mar 21, 2021
1 parent 6560a76 commit a9bf17e
Show file tree
Hide file tree
Showing 6 changed files with 2,973 additions and 1,132 deletions.
15 changes: 1 addition & 14 deletions .eslintrc
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
{
"extends": ["airbnb-base/legacy", "prettier"],
"env": {
"es6": true,
"node": true,
"browser": true
},
"parserOptions": {
"sourceType": "module"
},
"rules": {
"semi": "off",
"no-console": "off",
"no-multi-spaces": "off"
}
"extends": "@antv/eslint-config"
}
3 changes: 3 additions & 0 deletions configs/eslint-config/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./lib/index.js"
}
41 changes: 41 additions & 0 deletions configs/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"private": true,
"name": "@antv/eslint-config",
"version": "1.0.0",
"main": "./lib/index.js",
"license": "MIT",
"files": [
"lib"
],
"scripts": {
"clean": "rimraf lib",
"lint": "eslint 'src/**/*.{js,ts}' --fix",
"build": "tsc --outDir ./lib",
"build:watch": "yarn build --w",
"prebuild": "run-s clean",
"preinstall": "run-s build"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^4.17.0",
"@typescript-eslint/parser": "^4.17.0",
"eslint": "^7.22.0",
"eslint-config-airbnb-typescript": "^12.3.1",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.3.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-promise": "^4.3.1",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-unicorn": "^28.0.2"

},
"devDependencies": {
"eslint": "^7.22.0",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
"typescript": "^4.2.3"
}
}
104 changes: 104 additions & 0 deletions configs/eslint-config/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
'eslint-comments',
'import',
'flowtype',
'jest',
'jsx-a11y',
'prettier',
'promise',
'react',
'react-hooks',
'unicorn',
],
extends: [
'airbnb-typescript',
'eslint:recommended',
'prettier',
'plugin:@typescript-eslint/recommended',
'plugin:jsx-a11y/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:promise/recommended',
'plugin:prettier/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
],
env: {
browser: true,
commonjs: true,
es6: true,
jest: true,
node: true,
mocha: true,
jasmine: true,
},
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
requireConfigFile: false,
},
settings: {
react: {
version: 'detect',
},
},
rules: {
'no-shadow': 0,
'no-continue': 0,
'no-multi-assign': 0,
'no-nested-ternary': 0,
'prefer-destructuring': 0,
'class-methods-use-this': 0,
'implicit-arrow-linebreak': 0,
'lines-between-class-members': 0,
'no-param-reassign': [2, { props: false }],
'no-unused-expressions': [
2,
{ allowShortCircuit: true, allowTernary: true },
],
'no-cond-assign': [2, 'except-parens'],
eqeqeq: [2, 'always', { null: 'ignore' }],
'consistent-return': 0,

'import/export': 0,
'import/no-cycle': 0,
'import/no-unresolved': 0,
'import/prefer-default-export': 0,

'@typescript-eslint/no-namespace': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-non-null-assertion': 0,
'@typescript-eslint/no-empty-function': 0,
'@typescript-eslint/no-empty-interface': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,

camelcase: 0,
'@typescript-eslint/camelcase': 0,

'no-use-before-define': 0,
'@typescript-eslint/no-use-before-define': [
2,
{
classes: true,
functions: false,
variables: true,
enums: false,
typedefs: false,
ignoreTypeReferences: true,
},
],

'no-unused-vars': 0,
'@typescript-eslint/no-unused-vars': [
2,
{ vars: 'all', args: 'after-used', ignoreRestSiblings: true },
],
},
}
3 changes: 3 additions & 0 deletions configs/eslint-config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.json"
}
Loading

0 comments on commit a9bf17e

Please sign in to comment.