Skip to content

Commit

Permalink
Merge pull request #38 from bento-platform/lint/prettier-eslint
Browse files Browse the repository at this point in the history
lint: update eslint, add + run prettier, add commitlint
  • Loading branch information
davidlougheed authored Oct 31, 2024
2 parents 92f2c0f + d5022a2 commit 89a5653
Show file tree
Hide file tree
Showing 18 changed files with 2,584 additions and 1,145 deletions.
23 changes: 0 additions & 23 deletions .eslintrc.cjs

This file was deleted.

4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"tabWidth": 4,
"printWidth": 120
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ Run these steps once to setup commitlint + husky.
# Install dev dependencies (commitlint & husky)
npm install
# Install husky git hook
npx husky install
npx husky
# Add commitlint as a hook to husky
npx husky add .husky/commit-msg 'npx --no -- commitlint --edit ${1}'
echo 'npx --no -- commitlint --edit ${1}' > .husky/commit-msg
```

### Usage
Expand Down
26 changes: 25 additions & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
module.exports = { extends: ['@commitlint/config-conventional'] };
export default {
extends: ["@commitlint/config-conventional"],
rules: {
"type-enum": [
2,
"always",
[
// default set:
"build",
"chore",
"ci",
"docs",
"feat",
"fix",
"perf",
"refactor",
"revert",
"style",
"test",
// bento added:
"lint",
],
],
},
};
46 changes: 46 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import globals from "globals";
import js from "@eslint/js";

// Parser
import tsParser from "@typescript-eslint/parser";

// Plugins
import tsEsLint from "typescript-eslint";
import react from "eslint-plugin-react";
import reactHooksEsLint from "eslint-plugin-react-hooks";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
import prettier from "eslint-plugin-prettier";

export default [
js.configs.recommended,
...tsEsLint.configs.recommended,
react.configs.flat.recommended,
react.configs.flat["jsx-runtime"],
eslintPluginPrettierRecommended,
{
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: { ...globals.browser, ...globals.es2021 },
parser: tsParser,
},
files: ["src/**/*.ts", "src/**/*.tsx", "src/**/*.js", "src/**/*.jsx"],
plugins: {
react,
"react-hooks": reactHooksEsLint,
prettier,
},

settings: {
react: {
version: "detect",
},
},
rules: {
"prettier/prettier": "error",
"react/prop-types": "off",
semi: [2, "always"],
...reactHooksEsLint.configs.recommended.rules,
},
},
];
Loading

0 comments on commit 89a5653

Please sign in to comment.