Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Deprecate formatting rules #17696

Merged
merged 7 commits into from Nov 3, 2023
Merged

feat: Deprecate formatting rules #17696

merged 7 commits into from Nov 3, 2023

Conversation

nzakas
Copy link
Member

@nzakas nzakas commented Oct 30, 2023

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[x] Other, please explain:

Deprecates rules

What changes did you make? (Give an overview)

Deprecates the agreed-upon rules

Fixes #17522

Is there anything you'd like reviewers to focus on?

Please double-check that I didn't miss any of the rules we agreed to deprecate.

@eslint-github-bot eslint-github-bot bot added the feature This change adds a new feature to ESLint label Oct 30, 2023
@netlify
Copy link

netlify bot commented Oct 30, 2023

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit b0f87f8
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/65450a1c0a14e60007d85748

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecated rules are automatically removed from eslint:all.

@nzakas
Copy link
Member Author

nzakas commented Oct 31, 2023

No idea why I'm getting a warning around marking rules as deprecated. It seems like I've set up everything correctly.

@mdjermanovic
Copy link
Member

No idea why I'm getting a warning around marking rules as deprecated. It seems like I've set up everything correctly.

We should update the docs too.

Example:

This rule was **deprecated** in ESLint v8.46.0 with no replacement. The original intent of this rule no longer applies due to the fact JavaScript now handles native `Promises` differently. It can now be slower to remove `await` rather than keeping it. More technical information can be found in [this V8 blog entry](https://v8.dev/blog/fast-async).

@antfu
Copy link
Contributor

antfu commented Oct 31, 2023

I wonder if there would be a better phrase than "deprecated with no replacement" (as we http://eslint.style/ are taking over as the "replacement") - maybe point to the blog post instead?

@mdjermanovic mdjermanovic added rule Relates to ESLint's core rules accepted There is consensus among the team that this change meets the criteria for inclusion deprecation This change deprecates an existing feature labels Oct 31, 2023
@nzakas
Copy link
Member Author

nzakas commented Nov 1, 2023

@mdjermanovic the output seems to indicate that either updating the source code OR updating the README should satisfy this check. However, from the code, it looks like both are required. I'll fix the messaging as part of this.

@antfu We can do that. Is the prefix for all rules @stylistic/js? And is the URL format always https://eslint.style/rules/js/<ruleId>?

@antfu
Copy link
Contributor

antfu commented Nov 2, 2023

Yes, exactly. Thanks

@nzakas nzakas marked this pull request as ready for review November 2, 2023 20:48
@nzakas nzakas requested a review from a team as a code owner November 2, 2023 20:48
@mdjermanovic
Copy link
Member

This test will fail when we release @eslint/js v8.53.0 because semi and func-call-spacing are no longer in eslint:all, so it might be good to update it now:

it("should use eslint:all rules when eslint:all configuration is specified", async () => {
eslint = new ESLint({
useEslintrc: false,
overrideConfig: {
extends: ["eslint:all"]
},
ignore: false,
cwd: getFixturePath()
});
const options = { filePath: "file.js" };
const results = await eslint.lintText("foo ()", options);
assert.strictEqual(results.length, 1);
const { messages } = results[0];
// Some rules that should report errors in the given code. Not all, as we don't want to update this test when we add new rules.
const expectedRules = ["no-undef", "semi", "func-call-spacing"];
expectedRules.forEach(ruleId => {
const messageFromRule = messages.find(message => message.ruleId === ruleId);
assert.ok(
typeof messageFromRule === "object" && messageFromRule !== null, // LintMessage object
`Expected a message from rule '${ruleId}'`
);
assert.strictEqual(messageFromRule.severity, 2);
});

@mdjermanovic
Copy link
Member

no-extra-semi and no-mixed-spaces-and-tabs are also in the recommended config. Since they're deprecated, perhaps we should remove them from the recommended config as well?

"no-extra-semi": "error",

recommended: true,

"no-mixed-spaces-and-tabs": "error",

@nzakas
Copy link
Member Author

nzakas commented Nov 3, 2023

I fixed the test. We generally don't remove rules from eslint:recommended outside of a major release. It's one thing to deprecate rules, but I don't think people will expect rules that they have enabled via eslint:recommended to be turned off in a minor release. Maybe we wait and do that in v9.0.0?

@mdjermanovic
Copy link
Member

I fixed the test.

Did you push that change?

@nzakas
Copy link
Member Author

nzakas commented Nov 3, 2023

Oops. 😆 Got distracted. Pushed now.

@mdjermanovic
Copy link
Member

We generally don't remove rules from eslint:recommended outside of a major release. It's one thing to deprecate rules, but I don't think people will expect rules that they have enabled via eslint:recommended to be turned off in a minor release. Maybe we wait and do that in v9.0.0?

I agree with removing those two rules from eslint:recommended in v9.0.0.

Our semver policies do allow removing rules from eslint:recommended in a minor version, but I think we used that clause only when some rules had problematic behavior.

@nzakas
Copy link
Member Author

nzakas commented Nov 3, 2023

Our semver policies do allow removing rules from eslint:recommended in a minor version, but I think we used that clause only when some rules had problematic behavior.

Yes, that was the intent. 👍 I added a note to remove these rules in v9.0.0: #17596

Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@mdjermanovic mdjermanovic merged commit 528e1c0 into main Nov 3, 2023
22 checks passed
@mdjermanovic mdjermanovic deleted the issue17522 branch November 3, 2023 15:12
bmish added a commit to bmish/eslint that referenced this pull request Nov 5, 2023
* main: (248 commits)
  Revert "chore: remove metascraper (eslint#17707)" (eslint#17708)
  8.53.0
  Build: changelog update for 8.53.0
  chore: remove metascraper (eslint#17707)
  chore: Update dependencies (eslint#17706)
  chore: package.json update for @eslint/js release
  docs: change position of return to top button (eslint#17688)
  feat: Deprecate formatting rules (eslint#17696)
  test: fix ESLint tests for caching (eslint#17699)
  feat: Add suggestions for no-prototype-builtins (eslint#17677)
  docs: update twitter icon to new X icon (eslint#17687)
  fix: ensure that exit code for fatal errors is not overwritten (eslint#17683)
  docs: Update README
  docs: Fix tabs in rule examples (eslint#17653)
  docs: explained rule fixers and suggestions (eslint#17657)
  ci: bump actions/setup-node from 3 to 4 (eslint#17676)
  fix: add `;` after JSX nodes in  `no-object-constructor` autofix (eslint#17672)
  ci: run tests in Node.js 21 (eslint#17673)
  8.52.0
  Build: changelog update for 8.52.0
  ...
@siarheipashkevich
Copy link

@nzakas how to see all deprecated rules which are used in my project running CLI command?

@eslint eslint locked as off-topic and limited conversation to collaborators Nov 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion deprecation This change deprecates an existing feature feature This change adds a new feature to ESLint rule Relates to ESLint's core rules
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

Change Request: Deprecate formatting rules and recommend using a source code formatter
4 participants