Skip to content

Commit

Permalink
feat: lint and pre-commit hook with Husky and eslint (#33)
Browse files Browse the repository at this point in the history
Co-authored-by: Oliver Eyton-Williams <[email protected]>
  • Loading branch information
Sembauke and ojeytonwilliams authored Apr 8, 2024
1 parent 73a616e commit 18d207f
Show file tree
Hide file tree
Showing 16 changed files with 1,331 additions and 32 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/**
storybook-static/**
*.config.js
25 changes: 25 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:jest-dom/recommended",
"plugin:jsx-a11y/recommended",
"plugin:testing-library/react"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"settings": {
"react": {
"version": "detect"
}
}
}
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
1 change: 1 addition & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "*.{js,jsx,ts,tsx}": "eslint" }
21 changes: 17 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,17 @@
"dev:js": "cross-env NODE_ENV=development rollup -c -w ",
"dev:css": "pnpm tailwindcss -i ./src/base.css -o ./dist/base.css --watch",
"develop": "npm-run-all --parallel dev:css dev:js storybook",
"format": "prettier --write .",
"lint": "prettier --check .",
"format:eslint": "eslint . --fix",
"format:prettier": "prettier --write .",
"format": "pnpm run format:eslint && pnpm run format:prettier",
"lint": "prettier --check . && eslint . --max-warnings 0",
"start": "pnpm run develop",
"storybook": "storybook dev -p 6006 --no-open",
"storybook:theming": "pnpm run storybook --no-manager-cache",
"clean": "rm -rf dist/*",
"gen-component": "ts-node ./utils/gen-component-script",
"test": "jest"
"test": "jest",
"prepare": "husky"
},
"dependencies": {
"@fortawesome/free-solid-svg-icons": "6.4.2",
Expand All @@ -58,6 +61,7 @@
"@rollup/plugin-babel": "5.3.1",
"@rollup/plugin-commonjs": "19.0.2",
"@rollup/plugin-node-resolve": "13.3.0",
"@rollup/plugin-terser": "0.4.4",
"@rollup/plugin-typescript": "8.5.0",
"@storybook/addon-a11y": "^8.0.5",
"@storybook/addon-actions": "^8.0.5",
Expand All @@ -77,21 +81,30 @@
"@types/react": "16.14.56",
"@types/react-dom": "16.9.17",
"@types/testing-library__jest-dom": "5",
"@typescript-eslint/eslint-plugin": "^7.5.0",
"@typescript-eslint/parser": "^7.5.0",
"autoprefixer": "10.4.17",
"babel-loader": "8.3.0",
"babel-plugin-transform-react-remove-prop-types": "0.4.24",
"cross-env": "7.0.3",
"css-loader": "6.8.1",
"eslint": "^8.57.0",
"eslint-plugin-jest-dom": "^5.2.0",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-testing-library": "^6.2.0",
"husky": "^9.0.11",
"jest": "29.7.0",
"jest-environment-jsdom": "^29.7.0",
"lint-staged": "^15.2.2",
"npm-run-all2": "5.0.2",
"postcss": "8.4.35",
"postcss-import": "14.1.0",
"postcss-loader": "8.1.0",
"prettier": "3.2.5",
"rollup": "2.79.1",
"rollup-plugin-postcss": "4.0.2",
"@rollup/plugin-terser": "0.4.4",
"storybook": "^8.0.5",
"style-loader": "3.3.3",
"tailwindcss": "3.4.1",
Expand Down
Loading

0 comments on commit 18d207f

Please sign in to comment.