Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
docs: rework structure and improve flat config docs#8507
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Thanks for the PR,@bradzacher! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently onhttps://opencollective.com/typescript-eslint. |
netlifybot commentedFeb 19, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
✅ Deploy Preview fortypescript-eslint ready!
To edit notification comments on pull requests, go to yourNetlify site configuration. |
nx-cloudbot commentedFeb 19, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
🔥 Looks great to me! Really liking the tweaked flow.
Some proofreading thoughts inline, nothing blocking IMO.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Is the before/after comparison flipped in the PR description? |
export default tseslint.config( | ||
{ | ||
// config with just ignores is the replacement for `.eslintignore` | ||
ignores: ['**/build/**', '**/dist/**', 'src/some/file/to/ignore.ts'], | ||
}, |
pete-willardFeb 19, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
question: I applaud the idea of starting the example config with a global ignore in the new flat convention but is this syntax correct? I'm getting anObject literal may only specify known properties, and 'ignores' does not exist in type 'ConfigWithExtends'.
error while attempting to refactor my own config to use this exact same syntax.
bradzacherFeb 19, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@pete-willard try updating to (the just released) v7.0.2 first which included a fix so that TS could resolve the types correctly.
This is correct and should work just fine - it's what we do internally:
typescript-eslint/eslint.config.mjs
Lines 45 to 63 in677e7cc
{ | |
// config with just ignores is the replacement for `.eslintignore` | |
ignores:[ | |
'**/jest.config.js', | |
'**/node_modules/**', | |
'**/dist/**', | |
'**/fixtures/**', | |
'**/coverage/**', | |
'**/__snapshots__/**', | |
'**/.docusaurus/**', | |
'**/build/**', | |
// Files copied as part of the build | |
'packages/types/src/generated/**/*.ts', | |
// Playground types downloaded from the web | |
'packages/website/src/vendor', | |
// see the file header in eslint-base.test.js for more info | |
'packages/rule-tester/tests/eslint-base', | |
], | |
}, |
I picked it as a good example of "a separate config object" and thought it was a great example cos almost every codebase I've worked on has a.eslintignore
!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It is a great example to have 👍🏻 I just double checked (reinstalled packages, rebooted VSCode) and I am on the .2 version and still getting that error. Mind you my config is a.js
file with the@ts-check
directive. I'll try more tinkering in the morning. Sorry for hijacking the comment 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I just tested this locally and it worked.
I also added a passing test case to our integration test:
https://github.com/typescript-eslint/typescript-eslint/blob/bjz-rework-docs-20240219/packages/integration-tests/fixtures/flat-config-types/eslint.config.js#L21-L24
(this test runs to typecheck and validate we haven't broken the most barebones setup).
If you can create an isolated repro repo and file an issue - I'm happy to help investigate :)
Uh oh!
There was an error while loading.Please reload this page.
PR Checklist
tseslint.config
helper in Getting Started #8496Overview
This started as me just adding some more content to the docs and evolved into me restructuring things a bit. I was going to create a whole new page on what I was going to call "advanced config" - however I later decided that we don't really need to provide that information as it is ultimately well covered by the ESLint docs.
This PR:
.eslintrc.js
code samples.typescript-eslint
package docs.typescript-eslint
so that it uses both default and named exports.tseslint.config
alternative a bit nicerimport('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigFile
- now it can be accomplished withimport('typescript-eslint').Config
.Configs
to theUsers
section. This felt a little cleaner overall: