Skip to content

Conversation

XhmikosR
Copy link
Contributor

@XhmikosR XhmikosR commented Jan 6, 2022

🎉 Thanks for sending this pull request! 🎉

Please make sure the title is clear and descriptive.

If you are fixing a typo or documentation, please skip these instructions.

Otherwise please fill in the sections below.

Which problem is this pull request solving?

Example: I'm always frustrated when [...]

List other issues or pull requests related to this problem

Example: This fixes #5012

Describe the solution you've chosen

Example: I've fixed this by [...]

Describe alternatives you've considered

Example: Another solution would be [...]

Checklist

Please add a x inside each checkbox:

  • I have read the contribution guidelines.
  • The status checks are successful (continuous integration). Those can be seen below.
@XhmikosR
Copy link
Contributor Author

XhmikosR commented Jan 6, 2022

These are the changes on the cli repo: netlify/cli@main...XhmikosR:test-eslint

unicorn/prefer-object-from-entries might be good to enable too (see the separate patch), but not all cases are auto-fixable:

> netlify-cli@8.6.5 format:fix:lint > cross-env-shell eslint --fix $npm_package_config_eslint error: Prefer `Object.fromEntries()` over `Array#reduce()` (unicorn/prefer-object-from-entries) at site\scripts\generate-command-data.js:25:6: 23 | .filter((option) => !option.hidden) 24 | .sort(sortOptions) > 25 | .reduce((prev, cur) => { | ^ 26 | const name = cur.long.replace('--', '') 27 | const contentType = cur.argChoices ? cur.argChoices.join(' | ') : 'string' 28 | error: Prefer `Object.fromEntries()` over `Array#reduce()` (unicorn/prefer-object-from-entries) at src\utils\addons\validation.js:10:37: 8 | 9 | const updateConfigValues = function (allowedConfig, currentConfig, newConfig) { > 10 | return Object.keys(allowedConfig).reduce((acc, key) => { | ^ 11 | if (newConfig[key]) { 12 | acc[key] = newConfig[key] 13 | return acc error: Prefer `Object.fromEntries()` over `Array#reduce()` (unicorn/prefer-object-from-entries) at src\utils\parse-raw-flags.js:14:24: 12 | 13 | const parseRawFlags = function (raw) { > 14 | const rawFlags = raw.reduce((acc, curr, index, array) => { | ^ 15 | if (/^-{1,2}/.test(curr)) { 16 | const key = curr.replace(/^-{1,2}/, '') 17 | const next = array[index + 1] 3 errors found. 
@erezrokah erezrokah added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Jan 6, 2022
@erezrokah erezrokah changed the title [TESTING] Enable a few more rules feat: [TESTING] Enable a few more rules Jan 6, 2022
@XhmikosR
Copy link
Contributor Author

XhmikosR commented Jan 8, 2022

Let me know how do you want to proceed with unicorn/prefer-object-from-entries. Maybe we should land this as is and cut a new version and then try to enable unicorn/prefer-object-from-entries?

@XhmikosR XhmikosR marked this pull request as ready for review January 8, 2022 09:18
@XhmikosR XhmikosR changed the title feat: [TESTING] Enable a few more rules feat: Enable a few more newer Node.js rules Jan 10, 2022
@ehmicky
Copy link
Contributor

ehmicky commented Jan 10, 2022

Thanks a lot @XhmikosR!

About Object.fromEntries(), I believe the ESLint Unicorn rule is unfortunately too strict when it comes to some legitimate usage of Array.reduce() as you mention, so I would personally not favor enabling this specific rule.

@kodiakhq kodiakhq bot merged commit 3367a21 into netlify:main Jan 10, 2022
@XhmikosR XhmikosR deleted the patch-1 branch January 10, 2022 17:26
@ascorbic
Copy link
Contributor

In future, can updates that enable new rules be treated as breaking changes and released as a new major version?

@ehmicky
Copy link
Contributor

ehmicky commented Jan 11, 2022

Absolutely. Sorry, and thanks for the reminder @ascorbic 🙏

@ascorbic
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge type: feature code contributing to the implementation of a feature and/or user facing functionality

4 participants