Skip to content

Commit

Permalink
Merge pull request #439 from HarperDB/akers/pre-commit-hooks
Browse files Browse the repository at this point in the history
Adding Pre-commit Hooks & Improving Prettier/ESLint rules
  • Loading branch information
BboyAkers authored Dec 2, 2024
2 parents 7a57726 + 10e52f4 commit a71fc35
Show file tree
Hide file tree
Showing 6 changed files with 322 additions and 43 deletions.
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yarn lint-staged
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
package-lock.json
dist
lint-*
14 changes: 12 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
{
"printWidth": 180,
"singleQuote": true
"printWidth": 120,
"quoteProps": "consistent",
"singleQuote": true,
"trailingComma": "es5",
"useTabs": true,
"endOfLine": "auto",
"tabWidth": 2,
"semi": true,
"bracketSameLine": false,
"bracketSpacing": true,
"jsxSingleQuote": false,
"arrowParens": "always"
}
72 changes: 40 additions & 32 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,52 @@ import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [...fixupConfigRules(
compat.extends("react-app", "airbnb", "plugin:jsx-a11y/recommended", "prettier"),
), {
export default [
...fixupConfigRules(compat.extends("react-app", "airbnb", "plugin:jsx-a11y/recommended", "prettier")),
{
// root: true,
plugins: {
"jsx-a11y": fixupPluginRules(jsxA11Y),
prettier
"jsx-a11y": fixupPluginRules(jsxA11Y),
prettier,
},

rules: {
camelcase: 0,
"no-nested-ternary": 0,
"no-param-reassign": 0,
"no-return-assign": 0,
"no-restricted-syntax": 0,
"react/jsx-filename-extension": 0,
"react/jsx-props-no-spreading": 0,
"react/destructuring-assignment": 0,
"react/prop-types": 0,
"react/no-danger": 0,
"no-unused-vars": 1,
"react/button-has-type": 1,
"import/no-named-as-default": 0,
"import/no-named-as-default-member": 0,
"no-underscore-dangle": ["warn", {
allow: ["_kmq", "_kmk"],
}],
"no-unsafe-optional-chaining": 0,
"jsx-a11y/label-has-associated-control": 0,
"react/jsx-no-bind": 0,
camelcase: 0,
"import/no-extraneous-dependencies": ["error", { devDependencies: true }],
"no-nested-ternary": 0,
"no-param-reassign": 0,
"no-return-assign": 0,
"no-restricted-syntax": 0,
"react/jsx-filename-extension": 0,
"react/jsx-props-no-spreading": 0,
"react/destructuring-assignment": 0,
"react/prop-types": 0,
"react/no-danger": 0,
"no-unused-vars": 1,
"react/button-has-type": 1,
"import/no-named-as-default": 0,
"import/no-named-as-default-member": 0,
"no-underscore-dangle": [
"warn",
{
allow: ["_kmq", "_kmk"],
},
],
"no-unsafe-optional-chaining": 0,
"jsx-a11y/label-has-associated-control": 0,
"react/jsx-no-bind": 0,

"react/no-unstable-nested-components": ["warn", {
allowAsProps: true,
}],
"react/no-unstable-nested-components": [
"warn",
{
allowAsProps: true,
},
],
},
}];
},
];
14 changes: 12 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"build:prod": "DISABLE_ESLINT_PLUGIN=true GENERATE_SOURCEMAP=false PUBLIC_URL=https://ds5zz9rfvzuta.cloudfront.net react-scripts build",
"build:local": "DISABLE_ESLINT_PLUGIN=true BUILD_PATH=./build-local GENERATE_SOURCEMAP=false REACT_APP_LOCALSTUDIO=true react-scripts build",
"lint-dev": "eslint --fix src && npx stylelint --fix \"src/**/*.scss\"",
"lint-prod": "eslint --fix src"
"lint-prod": "eslint --fix src",
"prepare": "husky"
},
"dependencies": {
"@monaco-editor/react": "^4.2.0",
Expand Down Expand Up @@ -50,7 +51,7 @@
"whatwg-fetch": "^3.6.2"
},
"engines": {
"node": ">=14.0.0"
"node": ">=20.18.0"
},
"browserslist": {
"production": [
Expand All @@ -64,6 +65,12 @@
"last 1 safari version"
]
},
"lint-staged": {
"**/*": [
"prettier --write --ignore-unknown",
"eslint --fix"
]
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@eslint/compat": "^1.1.1",
Expand All @@ -76,6 +83,9 @@
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react-hooks": "^4.6.2",
"husky": "^9.1.7",
"lint-staged": "^15.2.10",
"pinst": "^3.0.0",
"postcss-custom-properties": "^14.0.1",
"prettier": "^3.1.0",
"sass": "^1.46.0",
Expand Down
Loading

0 comments on commit a71fc35

Please sign in to comment.