Personal presets used in my projects.
Included:
- @typescript-eslint
- compatible with prettier
- eslint-plugin-unused-imports
- Vue support (default)
- modular approach to adjust for different environments
Vue application with TypeScript. Also enables different globals for config files (ran in node) vs. app src code (ran in browser).
// eslint.config.js
import {
vueConfig,
browserGlobalsConfig,
nodeGlobalsConfig,
} from '@linusborg/eslint-config'
export default [
...vueConfig,
{
// for config files
files: ['*.ts', '*.js'],
...nodeGlobalsConfig,
},
{
// for browser code
files: ['src/**/*.ts', 'src/**/*.js', 'src/**/*.vue'],
...browserGlobalsConfig,
},
]Use this if you're building a Vue based application, plugin or library that will involve SFCs.
Use this if you are building a library or application that does not involve Vue SFCs.
This adds node globals, so should be used with a file filter for config files.
{
files: ['*.ts', '*.js'],
...nodeGlobalsConfig,
}This should be combined with the vue or base config for the actual source files when your app/library will run in the browser.
{
files: ['src/**/**ts', 'src/**/*.js', 'src/**/*.vue'],
...browserGlobalsConfig,
}This should be combined with the vue or base config for the actual source files when your app/library will run in the browser AND the server.
{
files: ['src/**/**ts', 'src/**/*.js', 'src/**/*.vue'],
...sharedSSRGlobalsConfig,
}Re-export of the globals package, in case you need it for more custom configs.