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

Fixed global eslint and tsconfig #36

Merged
merged 6 commits into from
Mar 7, 2024
Merged

Fixed global eslint and tsconfig #36

merged 6 commits into from
Mar 7, 2024

Conversation

oskardudycz
Copy link
Collaborator

@oskardudycz oskardudycz commented Mar 7, 2024

Needed to configure a separate config for eslint, as it doesn't deal well with the TypeScript project references. Also, it wasn't checking correctly the eslint settings, as eslint requires wrapping global pattern in '' to be passed as a parameter instead of taken as the shell pattern. 🤦

Updated also pipeline to run ts build before linting to have correctly resolved dependencies between packages and non-package code.

Fixes #18.

They seem not to be needed when using npm workspaces, as it should add symlinks
The "funny thing" was that the issue was with not wrapping pattern with ''🤦. See eslint/eslint#13896 (comment)
@oskardudycz oskardudycz marked this pull request as ready for review March 7, 2024 10:07
@oskardudycz oskardudycz added enhancement New feature or request CI bug Something isn't working and removed enhancement New feature or request labels Mar 7, 2024
@oskardudycz oskardudycz added this to the 0.6.0 milestone Mar 7, 2024
@oskardudycz oskardudycz merged commit bc8f116 into main Mar 7, 2024
1 check passed
@oskardudycz oskardudycz deleted the eslint_fix branch March 7, 2024 10:16
@oskardudycz oskardudycz changed the title Removed project references from main tsconfig Fixed global eslint and tsconfig Mar 7, 2024
@@ -11,12 +11,12 @@
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:prettier/recommended"
],
"ignorePatterns": ["dist/", "lib/"],
"ignorePatterns": ["**/dist/", "**/lib/"],
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

To ignore nested folders inside packages.

@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.shared.json",
"include": ["./packages/**/*.ts", "./docs/**/*.ts", "./tsup.config.ts"],
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Eslint seems not to deal well with the project references. But they're needed to correctly resolve correctly dependencies by TypeScript. That's why, as a workaround, I added a dedicated file that removes dependencies but adds "./packages/**/*.ts". It's weird, but it works...

@@ -0,0 +1,3 @@
{
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Those dummy files are needed for vscode eslint plugin, as it runs eslint config locally for packages. And as in the file, we have a reference for tsconfig.eslint.json. Then if it won't find such a file in the local package folder, then it will cry out loud and doesn't highlight eslint errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix linter for global config
1 participant