Skip to content

Commit

Permalink
Final updates before release (#7)
Browse files Browse the repository at this point in the history
* Downgrade eslint-plugin-lodash

Lodash 8.0.0 has eslint@>=9.0.0 as a peer dependency

* Add rules for unicorn changes
  • Loading branch information
dcroote authored Jun 24, 2024
1 parent 858925a commit 2892324
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jest": "^28.6.0",
"eslint-plugin-jest-formatting": "^3.1.0",
"eslint-plugin-lodash": "^8.0.0",
"eslint-plugin-lodash": "^7.4.0",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.32.1",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/universal.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,18 @@ module.exports = {

/* Rule overrides for "unicorn" plugin */
'unicorn/consistent-function-scoping': 'off', // Disabling due to the rule's constraints conflicting with established patterns, especially in test suites where local helper or mocking functions are prevalent and do not necessitate exports.
'unicorn/import-style': [
'error',
{
styles: {
'node:path': { named: true }, // Allows import { join } from 'node:path';
'node:util': { default: true }, // Allows import util from 'node:util';
},
},
],
'unicorn/no-abusive-eslint-disable': 'off', // Already covered by different ruleset.
'unicorn/no-array-callback-reference': 'error', // Explicitly turned on, because it was initially disabled and "point free" notation was enforced using "functional/prefer-tacit". That said, the point free pattern is dangerous in JS. See: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-callback-reference.md.
'unicorn/no-array-for-each': 'off', // We use .forEach extensively across the api3dao org and even though this can be solved with --fix and there are benefits, it will generate a lot of friction.
'unicorn/no-array-reduce': 'off', // We are OK with using reduce occasionally, but I agree with the author that the code using reduce can easily get complex.
'unicorn/no-nested-ternary': 'off', // This rule is smarter than the standard ESLint rule, but conflicts with prettier so it needs to be turned off. Nested ternaries are very unreadable so it's OK if all of them are flagged.
'unicorn/no-null': 'off', // We use both null and undefined for representing three state objects. We could use a string union instead, but using combination of null and undefined is less verbose.
Expand Down

0 comments on commit 2892324

Please sign in to comment.