-
Notifications
You must be signed in to change notification settings - Fork 3
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
🚀 Feature: Compatibility layer for ESLint plugins #17
Comments
Hey 👋 Thanks for the suggestion, I did plan to add this API but I'm very new to ESLint hence the delay. (I would appreciate it if you could share a repo suitable for testing this API.) |
Swell! I've got a couple on my personal account that exercise some edge cases:
eslint/eslint#18093 is a good tracking issue to see plugins that support ESLint's new flat config format. |
Exampleimport { defineConfig } from '@tsslint/config';
import { loadPluginRules } from '@tsslint/eslint';
export default defineConfig({
rules: {
...convertConfig(((await import('eslint-plugin-expect-type')).configs).recommended.rules),
...convertConfig(((await import('@typescript-eslint/eslint-plugin')).default.configs).recommended.rules ?? {}),
},
}); Or: import { defineConfig } from '@tsslint/config'
import { convertConfig } from '@tsslint/eslint'
export default defineConfig({
rules: convertConfig({
'@typescript-eslint/no-misused-promises': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/no-unsafe-enum-comparison': 'warn',
'@typescript-eslint/no-floating-promises': 'warn',
}),
}); Since some plugin config has the extends option, implementing the |
I find that the If you need to completely convert a ESLint config, you can refer to vuejs/core#12497. |
👋 again! This and https://github.com/Quramy/typescript-eslint-language-service are two really exciting avenues of being able to run ideally much faster typed linting as a part of the TypeScript language service. Ideally we'd be able to run all of a project's linting through this one - including existing ESLint plugins.
One issue that plagued TSLint back in the day was that it didn't support ESLint plugins natively. Everything had to be rewritten from ESTree to TypeScript's AST format.
Would you be interested in some kind of compatibility layer that lets folks natively use ESLint rules and plugins in TSSLint?
Vaguely guessing at an initial API design:
It looks like
./packages/eslint
already has aconvertRule
that does a lot of this work - so maybe this is already planned? 🙂The text was updated successfully, but these errors were encountered: