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

refactor: Rewrite the ESLint config file for this repo with Flat Config #355

Merged
merged 7 commits into from
Dec 9, 2024

Conversation

wakamsha
Copy link
Contributor

@wakamsha wakamsha commented Dec 9, 2024

What changed / motivation ?

When ESLint is updated to v9 in #354, eslintrc will be deprecated, and it will become difficult to use .eslintrc.js for this repository. Therefore, I rewrote .eslintrc.js as eslint.config.mjs in advance.

In addition, as a result of this, invalid code that was not detected before is now properly detected, so I fixed them at this time.

Linked PR / Issues

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Chore (routine task, maintenance, or non-functional change that doesn't modify src or test files)

Pre-flight checklist

References

@wakamsha wakamsha self-assigned this Dec 9, 2024
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed with unicorn/prefer-export-from rule.

@@ -28,7 +28,7 @@ module.exports = {
'import/core-modules': [],
'import/ignore': [
'node_modules',
'\\.(coffee|scss|css|less|hbs|svg|json|jpg|jpeg|png|webp)$',
String.raw`\.(coffee|scss|css|less|hbs|svg|json|jpg|jpeg|png|webp)$`,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -39,12 +39,11 @@ module.exports = {
name: 'isNaN',
message: 'Use Number.isNaN instead.',
},
].concat(
confusingBrowserGlobals.map((g) => ({
...confusingBrowserGlobals.map((g) => ({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed with unicorn/prefer-spread rule.

Comment on lines +3 to +4
const { readdirSync } = require('node:fs');
const path = require('node:path');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed with unicorn/prefer-node-protocol rule.

})
.map((dirnet) => extractFilePath(dirnet, dir))
.flat();
}).flatMap((dirnet) => extractFilePath(dirnet, directory));
Copy link
Contributor Author

Choose a reason for hiding this comment

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


test('parsable all eslintrc format configs', () => {
const dir = resolve(join(__dirname, '../configs/eslintrc'));
const directory = path.resolve(path.join(__dirname, '../configs/eslintrc'));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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 was installed for snapshot testing, but it was found to be unnecessary so I deleted it.

Copy link
Member

@taigakiyokawa taigakiyokawa left a comment

Choose a reason for hiding this comment

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

LGTM 🙆‍♂️ Thank you!

@wakamsha wakamsha merged commit 73ba58a into main Dec 9, 2024
2 checks passed
@wakamsha wakamsha deleted the refactor/introduce-flat-config branch December 9, 2024 09:52
@oss-frontend-github-app
Copy link

🎉 This PR is included in version 5.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants