Skip to content

Commit

Permalink
chore: improve lint setup
Browse files Browse the repository at this point in the history
- update eslint config to closely mirror the ones from ferdium-app
- add .eslintignore
- opt in to eslint `reportUnusedDisableDirectives` config option
- remove `trailingComma: all` from `prettier` config which is default in `prettier` v3
- autofix or disable a lot of lint issues throughout codebase
- add `volta` configuration to `package.json` to autoload correct `node` and `pnpm` versions
- upgrade all `eslint` and `prettier` related dependencies to latest
- update lint:fix npm script
- reformat touched files with prettier
  • Loading branch information
mcmxcdev committed Jul 24, 2023
1 parent 6d1d13a commit aeb1c88
Show file tree
Hide file tree
Showing 28 changed files with 504 additions and 352 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.devcontainer
.github
.husky
node_modules
19 changes: 18 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,23 @@ module.exports = {
jquery: true,
},
extends: ['eslint:recommended', 'plugin:unicorn/recommended'],
reportUnusedDisableDirectives: true,
rules: {
// eslint-plugin-unicorn
// eslint
'array-callback-return': 1,
'consistent-return': 1,
'no-await-in-loop': 1,
'no-return-assign': 1,
'no-console': [
1,
{
allow: ['warn', 'error'],
},
],
'no-param-reassign': 1,
'prefer-destructuring': 0,
// eslint-plugin-unicorn
'unicorn/filename-case': 0,
'unicorn/no-null': 0,
'unicorn/no-useless-undefined': 0,
'unicorn/prefer-module': 0,
Expand All @@ -31,5 +46,7 @@ module.exports = {
'unicorn/consistent-destructuring': 0,
'unicorn/no-array-reduce': 0,
'unicorn/no-nested-ternary': 0,
'unicorn/prefer-top-level-await': 0,
'unicorn/prefer-string-replace-all': 0,
},
};
1 change: 0 additions & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module.exports = {
singleQuote: true,
arrowParens: 'avoid',
trailingComma: 'all',
};
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
"doc": "docs"
},
"engines": {
"node": "18.15.0",
"pnpm": "8.6.2"
},
"volta": {
"node": "18.15.0",
"pnpm": "8.6.2"
},
"scripts": {
Expand All @@ -13,7 +18,7 @@
"package": "node scripts/package.js",
"create": "node scripts/create.js",
"lint": "eslint \"{recipes,scripts}/**/*.{js,jsx,ts,tsx}\"",
"lint:fix": "eslint --fix \"{recipes,scripts}/**/*.{js,jsx,ts,tsx}\"",
"lint:fix": "pnpm lint --fix",
"reformat-files": "prettier --ignore-path .eslintignore --write --require-pragma \"**/*.{js,json,scss}\"",
"contributors": "all-contributors"
},
Expand All @@ -34,14 +39,14 @@
"devDependencies": {
"@types/targz": "1.0.1",
"all-contributors-cli": "6.26.0",
"eslint": "8.39.0",
"eslint-plugin-unicorn": "42.0.0",
"eslint": "8.45.0",
"eslint-plugin-unicorn": "48.0.0",
"fs-extra": "11.1.1",
"husky": "8.0.3",
"image-size": "1.0.2",
"is-ci": "3.0.1",
"open": "8.4.1",
"prettier": "2.8.8",
"prettier": "3.0.0",
"simple-git": "3.19.0",
"targz": "1.0.1"
}
Expand Down
Loading

0 comments on commit aeb1c88

Please sign in to comment.