Consider incorporating rules from eslint-plugin-unicorn
- Dominant language
- JavaScript
- Stars
- 148k
- Forks
- 26.6k
- PR merge metrics
- No merged PRs in 30d
Description
By using code from [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn), the following style rules could be enforced:
- [explicit-length-check](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/master/docs/rules/explicit-length-check.md) - [15.3][] Use shortcuts for booleans, but explicit comparisons for strings and numbers.
- [import-index](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/master/docs/rules/import-index.md) - [23.6][] A base filename should exactly match the name of its default export.
[15.3]: https://github.com/airbnb/javascript#comparison--shortcuts
[23.6]: https://github.com/airbnb/javascript#naming--filename-matches-export
I also think that introducing new rules from the aforementioned plugin may help paving the way towards a more consistent coding style. For reference, see the rules below:
#### Avoid unexpected bugs
- [no-array-instanceof](docs/rules/no-array-instanceof.md) - Require `Array.isArray()` instead of `instanceof Array`. *(fixable)*
- [custom-error-definition](docs/rules/custom-error-definition.md) - Enforce correct `Error` subclassing. *(fixable)*
- [no-fn-reference-in-iterator](docs/rules/no-fn-reference-in-iterator.md) - Prevents passing a function reference directly to iterator methods. *(fixable)*
#### Enforce style consistency
- [no-abusive-eslint-disable](docs/rules/no-abusive-eslint-disable.md) - Enforce specifying rules to disable in `eslint-disable` comments.
- [throw-new-error](docs/rules/throw-new-error.md) - Require `new` when throwing an error. *(fixable)*
- [number-literal-case](docs/rules/number-literal-case.md) - Enforce lowercase identifier and uppercase value for number literals. *(fixable)*
- [escape-case](docs/rules/escape-case.md) - Require escape sequences to use uppercase values. *(fixable)*
- [no-hex-escape](docs/rules/no-hex-escape.md) - Enforce the use of unicode escapes instead of hexadecimal escapes. *(fixable)*
- [prefer-starts-ends-with](docs/rules/prefer-starts-ends-with.md) - Prefer `String#startsWith` & `String#endsWith` over more complex alternatives.
- [prefer-type-error](docs/rules/prefer-type-error.md) - Enforce throwing `TypeError` in type checking conditions. *(fixable)*
- [import-index](docs/rules/import-index.md) - Enforce importing index files with `.`. *(fixable)*
- [new-for-builtins](docs/rules/new-for-builtins.md) - Enforce the use of `new` for all builtins, except `String`, `Number` and `Boolean`. *(fixable)*
#### Warn about API deprecation
- [no-new-buffer](docs/rules/no-new-buffer.md) - Enforce the use of `Buffer.from()` and `Buffer.alloc()` instead of the deprecated `new Buffer()`. *(fixable)*
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the linked eslint-plugin-unicorn rule documentation and compare each proposed rule with the repository's current JavaScript style-guide rules. Done means selecting compatible rules and documenting or enforcing that decision; the issue names no implementation files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100