Skip to content

Commit

Permalink
feat: added prefer-filter
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaPontrandolfo committed Jun 22, 2024
1 parent 861bcfb commit 3ae6645
Show file tree
Hide file tree
Showing 14 changed files with 108 additions and 948 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,10 @@ These rules are purely matters of style and are quite subjective.

- [chain-style](docs/rules/chain-style.md): Enforce a specific chain style: explicit, implicit, or explicit only when necessary.
- [chaining](docs/rules/chaining.md): Prefer a either a Lodash chain or nested Lodash calls
- [collection-ordering](docs/rules/collection-ordering.md): Enforce a specific collection sorting method: `sortBy` or `orderBy`
- [consistent-compose](docs/rules/consistent-compose.md): Enforce a specific function composition direction: `flow` or `flowRight`.
- [identity-shorthand](docs/rules/identity-shorthand.md): Prefer identity shorthand syntax
- [matches-prop-shorthand](docs/rules/matches-prop-shorthand.md): Prefer matches property shorthand syntax
- [matches-shorthand](docs/rules/matches-shorthand.md): Prefer matches shorthand syntax
- [no-commit](docs/rules/no-commit.md): Do not use `.commit()` on chains that should end with `.value()`
- [path-style](docs/rules/path-style.md): Enforce a specific path style for methods like `get` and `property`: array, string, or arrays only for paths with variables. (fixable)
- [prefer-filter](docs/rules/prefer-filter.md): Prefer `_.filter` over `_.forEach` with an `if` statement inside.
- [prefer-find](docs/rules/prefer-find.md): Prefer `_.find` over `_.filter` followed by selecting the first result.
- [prefer-flat-map](docs/rules/prefer-flat-map.md): Prefer `_.flatMap` over consecutive `map` and `flatten`.
Expand Down
135 changes: 0 additions & 135 deletions docs/rules/collection-ordering.md

This file was deleted.

29 changes: 0 additions & 29 deletions docs/rules/identity-shorthand.md

This file was deleted.

83 changes: 0 additions & 83 deletions docs/rules/path-style.md

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"test": "npm run unit-test",
"unit-test": "cross-env nyc mocha ./tests/lib/rules/prefer-is-empty.js ./tests/lib/rules/prefer-is-nil.js ./tests/lib/rules/prefer-times.js ./tests/lib/rules/prefer-constant.js ./tests/lib/rules/prefer-lodash-typecheck.js ./tests/lib/rules/prefer-nullish-coalescing.js --reporter=dot",
"unit-test": "cross-env nyc mocha ./tests/lib/rules/prefer-is-empty.js ./tests/lib/rules/prefer-is-nil.js ./tests/lib/rules/prefer-times.js ./tests/lib/rules/prefer-constant.js ./tests/lib/rules/prefer-lodash-typecheck.js ./tests/lib/rules/prefer-nullish-coalescing.js ./tests/lib/rules/prefer-filter.js --reporter=dot",
"patch": "npm version patch -m\"update version to %s\" && git push --follow-tags",
"minor": "npm version minor -m\"update version to %s\" && git push --follow-tags",
"major": "npm version major -m\"update version to %s\" && git push --follow-tags"
Expand Down
11 changes: 4 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,23 @@ const recommended = {
"remeda/prefer-constant": 2,
"remeda/prefer-lodash-typecheck": 2,
"remeda/prefer-nullish-coalescing": 2,
// "remeda/prefer-flat-map": 2, // some tests are failing
// "remeda/prefer-find": 2, // some tests are failing
"remeda/prefer-filter": [2, 3],
// "remeda/prefer-noop": 2, //TODO: needs adaptation from https://remedajs.com/migrate/lodash/#noop
// "remeda/prefer-flat-map": 2, //FIXME: some tests are failing
// "remeda/prefer-find": 2, //FIXME: some tests are failing

// "remeda/prefer-map": 1,
// "remeda/prefer-filter": [2, 3],
// "remeda/prefer-some": [1, { includeNative: true }],
// "remeda/prefer-noop": 1,
// "remeda/chain-style": [1, "as-needed"],
// "remeda/chaining": 1,
// "remeda/collection-method-value": 1,
// "remeda/collection-ordering": 1,
// "remeda/collection-return": 1,
// "remeda/consistent-compose": [1, "flow"],
// "remeda/identity-shorthand": [1, "always"],
// "remeda/matches-prop-shorthand": [1, "always"],
// "remeda/matches-shorthand": [1, "always", 3],
// "remeda/no-commit": 1,
// "remeda/no-double-unwrap": 1,
// "remeda/no-unbound-this": 1,
// "remeda/path-style": [1, "string"],
// "remeda/prefer-get": [2, 3],
// "remeda/prefer-includes": [1, { includeNative: true }],
// "remeda/prefer-lodash-chain": 1,
Expand Down
Loading

0 comments on commit 3ae6645

Please sign in to comment.