Skip to content

Commit

Permalink
chore(eslint): set up code linting for commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
hydrosquall committed Jul 4, 2021
1 parent 177860a commit 72ac0c4
Show file tree
Hide file tree
Showing 4 changed files with 516 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
lib/
.eslintrc.js
*.yml
24 changes: 24 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: ["eslint:recommended"],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 12,
sourceType: "module",
},
plugins: ["@typescript-eslint"],
rules: {},
overrides: [
{
// No need to check for global definitions in Eslint, let Typescript compiler handle it.
// https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
files: ["*.ts", "*.tsx"],
rules: {
"no-undef": "off",
},
},
],
};
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"commit": "cz",
"clean": "yarn --force autoclean && yarn cache clean && rm -rf node_modules dist lib",
"build": "tsc -b",
"format": "prettier --write ./src",
"lint": "eslint ./src",
"type-check": "tsc --pretty -p tsconfig.json",
"test": "jest",
"styleguide": "styleguidist server",
Expand Down Expand Up @@ -67,6 +69,8 @@
"@types/react-color": "^3.0.0",
"@types/react-table": "^6.0.0",
"@types/styled-components": "^5.0.1",
"@typescript-eslint/eslint-plugin": "^4.28.1",
"@typescript-eslint/parser": "^4.28.1",
"acorn": "^7.1.1",
"acorn-jsx": "^5.1.0",
"auto": "^10.29.3",
Expand All @@ -77,6 +81,7 @@
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"enzyme-to-json": "^3.4.3",
"eslint": "^7.30.0",
"husky": "^6.0.0",
"jest": "^24.9.0",
"lint-staged": ">=10",
Expand All @@ -100,12 +105,12 @@
"webpack-dev-server": "^3.10.1"
},
"lint-staged": {
"*.tsx,*.ts,*.js,!*js.snap": [
"*.{js,jsx,ts,tsx}": [
"eslint --cache --fix",
"prettier --write"
],
"*.json,!package.json": [
"prettier --write"
],
"*.{js,jsx,ts,tsx}": "eslint --cache --fix"
]
}
}
Loading

0 comments on commit 72ac0c4

Please sign in to comment.