Skip to content

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

@socket-security
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
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