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

Switch to ESLint Flat Config #301

Merged
merged 19 commits into from
Nov 12, 2023
Merged

Switch to ESLint Flat Config #301

merged 19 commits into from
Nov 12, 2023

Conversation

karlhorky
Copy link
Member

@karlhorky karlhorky commented Nov 11, 2023

First part of #160

Convert to new ESLint Flat Config by following resources such as:

TODO

  • Convert config to flat config
  • Test with example projects
    • Node.js
    • @upleveled/create-react-app
    • Next.js
    • Next.js with Postgres.js
    • Expo

@@ -1,4 +1,18 @@
/** @type {import('@typescript-eslint/utils').TSESLint.Linter.RuleLevelAndOptions} */
Copy link
Member Author

Choose a reason for hiding this comment

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

actually would prefer to keep using the typescript-eslint types, but the FlatConfig types are not published yet, so work around this temporarily:

@karlhorky karlhorky changed the title Update config to ESLint Flat Config Switch to ESLint Flat Config Nov 11, 2023
Comment on lines +502 to +508
settings: {
'import/resolver': {
// Load <rootdir>/tsconfig.json
typescript: {
// Always try resolving any corresponding @types/* folders
alwaysTryTypes: true,
},
Copy link
Member Author

Choose a reason for hiding this comment

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

this is also ok in the new Flat Config format

{
// Lint common extensions by default with rules above
files: [
'**/*.js',
Copy link
Member Author

Choose a reason for hiding this comment

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

had to add **/*.js here - otherwise .js files would not be linted

Copy link

socket-security bot commented Nov 12, 2023

Updated dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
eslint-config-upleveled 6.1.2...7.0.0-1 None +0/-1 63.8 kB
eslint-config-upleveled 6.2.0...7.0.0-3 None +0/-0 63.9 kB

karlhorky added a commit to upleveled/create-react-app that referenced this pull request Nov 12, 2023
"type": "module" in package.json usually causes webpack to require a
fully-specified import path including .js

- https://webpack.js.org/configuration/module/#resolvefullyspecified

We require "type": "module" in package.json because ESLint we want to use ESM
syntax in our eslint.config.js file and ESLint does not support other ways of
specifying that the config file is ESM such as an .mjs extension:

- eslint/eslint#13440
- eslint/eslint#16580

This is a part of the switch to the ESLint Flat Config being done here:

- upleveled/eslint-config-upleveled#301
karlhorky added a commit to upleveled/preflight-test-project-react-passing that referenced this pull request Nov 12, 2023
@karlhorky karlhorky merged commit a441b57 into main Nov 12, 2023
4 checks passed
@karlhorky karlhorky deleted the eslint-flat-config branch November 12, 2023 17:57
@karlhorky karlhorky mentioned this pull request Feb 5, 2024
gruvector pushed a commit to gruvector/preflight-test-project that referenced this pull request Feb 9, 2024
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.

None yet

1 participant