Last active
June 8, 2024 00:41
-
-
Save joshnavdev/3634f849314358a58e044ba9edfa2fd0 to your computer and use it in GitHub Desktop.
EsLint + TypeScript + Prettier - Flat Config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
semi: true | |
tabWidth: 2 | |
printWidth: 120 | |
singleQuote: true | |
endOfLine: auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @ts-check | |
import eslint from '@eslint/js'; | |
import tseslint from 'typescript-eslint'; | |
import eslintConfigPrettier from 'eslint-config-prettier'; | |
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'; | |
export default tseslint.config( | |
{ | |
files: ['**/*.ts'], | |
extends: [eslint.configs.recommended, ...tseslint.configs.recommended], | |
rules: { | |
'no-console': 'warn', | |
'@typescript-eslint/no-unused-vars': 'error', | |
}, | |
}, | |
{ | |
files: ['**/*.js', '**/*.mjs', '**/*.ts'], | |
extends: [eslintPluginPrettierRecommended], | |
rules: { | |
...eslintConfigPrettier.rules, | |
}, | |
}, | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment