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

[eslint] switch to eslint.config.js #3600

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mdjermanovic
Copy link
Contributor

Updates linting for this repo to use ESLint flat config (eslint.config.js).

The goal is to test out flat config on popular ESLint plugins, please see eslint/eslint#13481 Phase 3: Compatibility testing.

I've verified that:

  • eslint . lints the same 249 files as before + the new eslint.config.js file + .eslint-doc-generatorrc.js
  • Lint results of eslint . are the same as before (0 errors and the exact same 50 warnings).
  • Calculated configs for files (eslint --print-config) are the same as before except for structural differences between eslintrc and flat config formats, and one change I made for the import/no-extraneous-dependencies rule.

'**/protractor.conf.*.js',
'**/karma.conf.js',
'**/.eslintrc.js',
'eslint.config.js',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added eslint.config.js to this list to fix 'globals' should be listed in the project's dependencies, not devDependencies errors. The rest is just copy-pasted from airbnb.

@@ -1,3 +1,5 @@
'use strict';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file wasn't linted before because it's a dotfile.

@@ -57,12 +58,13 @@
"eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-doc-generator": "^1.4.3",
"eslint-plugin-eslint-plugin": "^2.3.0 || ^3.5.3 || ^4.0.1 || ^5.0.5",
"eslint-plugin-eslint-plugin": "^2.3.0 || ^3.5.3 || ^4.0.1 || ^5.1.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Flat config exports that eslint.config.js uses were added in v5.1.0.

Comment on lines +112 to +117
{
files: ['markdown.config.js'],
rules: {
'no-console': 0,
},
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is copy-pasted from .eslintrc, but this file doesn't seem to exist so it probably can be removed.

@mdjermanovic
Copy link
Contributor Author

I'm not sure if the failures on CI are related to these changes.

@ljharb
Copy link
Member

ljharb commented Jul 9, 2023

I prefer .eslintrc as a format, and will stay with it until I’m absolutely forced not to. I’m happy to keep this PR open, though, to help eslint test.

There are indeed existing failures on master (i asked about them in the discord a month ago or so).

@ljharb ljharb marked this pull request as draft July 9, 2023 14:40
@jviall

This comment was marked as outdated.

@ljharb

This comment was marked as resolved.

@ebenali
Copy link

ebenali commented Jan 16, 2024

eslintrc is no longer searched for

@ljharb ljharb force-pushed the master branch 2 times, most recently from 380e32c to 51d342b Compare July 4, 2024 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants