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

Esm #240

Merged
merged 3 commits into from
Mar 28, 2024
Merged

Esm #240

merged 3 commits into from
Mar 28, 2024

Conversation

Kamii0909
Copy link
Contributor

ESLint is providing a new config format (typically called flat config). The old config format will be deprecated in ESLint 9.0 (currently in rc), and will be removed in ESLint 10. This commit migrate from the old
config format at .eslintrc.js to the new flat config one at
eslint.config.js.

In addition, 3 packages were added:

  • @types/eslint: A dev dependency used to provide ESLint rules code suggestion.
    This dependency is used to provide linting through jsdoc for styleRule
    function. It has a very weak consumption (only 1 function relies on
    it), but it is a small types package. The old config file also relies
    on it (but does not install it as a npm package).

  • globals: A dev dependency used to configure ESLint global linting environment.
    It is consumed by various other package, and already present on the path. Although, some package depend on a very old version of globals (babel), and with how terrible npm symlinking is, ESLint would import version 11.x.x, with a tragic yet funny bug that will break ESLint.

  • typescript-eslint: A dev dependency that provide first class Typescript integration with ESLint.
    It provides a convenient config function fully typed to create ESLint flat config array. Additionally, provide the recommended Typescript/ESLint settings that can be conveniently extended.

This commit also deleted 2 other dependencies:

  • @typescript-eslint/eslint-plugin
  • @typescript-eslint/parser

Both these two packages are no longer needed to be explicitly declared as typescript-eslint already import them. And it will make better decision on which version of them it should depend on.

chore: ESM support

package.json is changed to declare module (ESM), practically mark the project as an ESM first class. Additionally, using ESM module to configure Playwright and ESLint.

Note

This additionally apply more Typescript type checking linting rules, so a lot more linting errors would be apparent. This is not a problem of configuration, but a problem of code quality. I restricted some additional type linting to Typescript files (ts/tsx) only, but expect a lot more linting problems to surface.

Script

The lint script (npm run lint) is also modified to reflect the new change to the config file format, as the --ext options are not used with the new config format anymore.

Related Issue

Closes #233
Part of #44

Checklist

  • I have added commit messages that are descriptive and meaningful.
  • I have tested the changes locally.
  • I have reviewed the code changes.

Hà Trung Kiên added 3 commits March 27, 2024 16:08
ESLint is providing a new config format (typically called flat config).
The old config format will be deprecated in ESLint 9.0 (currently in
rc), and will be removed in ESLint 10. This commit migrate from the old
 config format at .eslintrc.js to the new flat config one at
 eslint.config.js.

In addition, 3 packages were added:

- @types/eslint: A dev dependency used to provide ESLint rules code
suggestion.
This dependency is used to provide linting through jsdoc for `styleRule`
 function. It has a very weak consumption (only 1 function relies on
 it), but it is a small types package. The old config file also relies
 on it (but does not install it as a npm package).

- globals: A dev dependency used to configure ESLint global linting
environment.
It is consumed by various other package, and already present on the
path. Although, some package depend on a very old version of globals
(babel), and with how terrible npm symlinking is, ESLint would import
version 11.x.x, with a tragic yet funny bug that will break ESLint.

- typescript-eslint: A dev dependency that provide first class
Typescript integration with ESLint.
It provides a convenient config function fully typed to create ESLint
flat config array. Additionally, provide the recommended
Typescript/ESLint settings that can be conveniently extended.

This commit also deleted 2 other dependencies:

- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser

Both these two packages are no longer needed to be explicitly declared
as typescript-eslint already import them. And it will make better
decision on which version of them it should depend on.

chore: ESM support

package.json is changed to declare module (ESM), practically mark the
project as an ESM first class. Additionally, using ESM module to
configure Playwright and ESLint.
With the new config file format, ESLint no longer accepts --ext flag,
as the new configuration file is capable of that already.
@fribbels
Copy link
Owner

Tested and the upgrade looks good to me, thanks!

@fribbels fribbels merged commit be036c2 into fribbels:beta Mar 28, 2024
1 check passed
@Kamii0909 Kamii0909 deleted the esm branch March 28, 2024 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants