Skip to content

Commit

Permalink
chore(contract-client): appease eslint
Browse files Browse the repository at this point in the history
This includes some fixes and updates to eslint configuration to make it
work as expected

- Extended `airbnb-typescript/base` to get it to stop yelling at me
  about importing files without file extension. Saw this recommended as
  the fix on StackOverflow [[1]]. And it makes sense to me that if we are
  extending Airbnb's lint rules and using TypeScript, we probably want
  their TypeScript-specific lint rules, too.
- Added the `eslint-plugin-jsdoc` plugin because the old `valid-jsdoc`
  rule we were using has been deprecated [[2]], and this plugin is the new
  way. Previously we had `valid-jsdoc: 1` (with some extra customization),
  and my guess is that extending `plugin:jsdoc/recommended` (plus some
  customization) is roughly equivalent.
- Researched [[3]] whether JSDoc `@param`-style docs or TSDoc-style
  `/** inline param docs */` work better. TSDoc work better. So disabled
  `jsdoc/require-param`.

  [1]: https://stackoverflow.com/a/67610259/249801
  [2]: https://eslint.org/docs/latest/rules/valid-jsdoc
  [3]: #962 (comment)
  • Loading branch information
chadoh committed May 10, 2024
1 parent e4db91c commit 31e6123
Show file tree
Hide file tree
Showing 11 changed files with 294 additions and 152 deletions.
12 changes: 10 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@ module.exports = {
env: {
es6: true,
},
extends: ["airbnb-base", "prettier"],
extends: [
"airbnb-base",
"airbnb-typescript/base",
"prettier",
"plugin:jsdoc/recommended",
],
plugins: ["@babel", "prettier", "prefer-import"],
parser: "@typescript-eslint/parser",
parserOptions: {
parser: "@typescript-eslint/parser",
project: "./config/tsconfig.json",
},
rules: {
"node/no-unpublished-require": 0,
},
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^18.0.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^48.2.4",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prefer-import": "^0.0.1",
"eslint-plugin-prettier": "^5.1.2",
Expand Down
10 changes: 3 additions & 7 deletions src/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ module.exports = {
camelcase: 0,
"class-methods-use-this": 0,
"linebreak-style": 0,
"jsdoc/require-returns": 0,
"jsdoc/require-param": 0,
"new-cap": 0,
"no-param-reassign": 0,
"no-underscore-dangle": 0,
"no-unused-vars": 0,
"no-use-before-define": 0,
"prefer-destructuring": 0,
"lines-between-class-members": 0,
Expand All @@ -21,14 +24,7 @@ module.exports = {
"prefer-import/prefer-import-over-require": [1],
"no-console": ["warn", { allow: ["assert"] }],
"no-debugger": 1,
"no-unused-vars": 1,
"arrow-body-style": 1,
"valid-jsdoc": [
1,
{
requireReturnDescription: false,
},
],
"prefer-const": 1,
"object-shorthand": 1,
"require-await": 1,
Expand Down
Loading

0 comments on commit 31e6123

Please sign in to comment.