A TypeScript ESLint shareable configuration that prioritizes safety over verbosity and provides comprehensive linting rules for TypeScript projects
npx @tessl/cli install tessl/npm-eslint-config-love@122.0.0ESLint Config Love is a comprehensive TypeScript ESLint shareable configuration that prioritizes safety over verbosity. It provides a complete, opinionated linting setup for TypeScript projects, excluding framework-specific rules and formatting rules while covering all areas not handled by strict TypeScript compilation.
npm install eslint-config-loveRequired peer dependencies that must be installed:
eslint (^9.12.0)typescript (*)ESM (ECMAScript Modules):
import love from 'eslint-config-love';CommonJS:
module.exports = (async function config() {
const { default: love } = await import('eslint-config-love');
return love;
})();import love from 'eslint-config-love';
export default [
{
...love,
files: ['**/*.js', '**/*.ts'],
},
];For CommonJS projects:
module.exports = (async function config() {
const { default: love } = await import('eslint-config-love');
return [
{
...love,
files: ['**/*.js', '**/*.ts'],
},
];
})();ESLint Config Love combines rules from multiple popular ESLint plugins into a single, cohesive configuration:
The configuration automatically sets up TypeScript parsing with project service support and enforces strict reporting of unused disable directives.
The main export provides a complete ESLint flat config object ready for use.
interface TSESLint.FlatConfig.Config {
linterOptions: {
reportUnusedDisableDirectives: 'error';
};
languageOptions: {
parser: TSESLint.FlatConfig.Parser;
parserOptions: {
projectService: true;
};
};
plugins: Record<string, TSESLint.FlatConfig.Plugin>;
rules: Record<string, TSESLint.SharedConfig.RuleEntry>;
}
declare const config: TSESLint.FlatConfig.Config;
export default config;The configuration includes:
projectService: trueThe configuration covers these areas:
TypeScript Rules (142 rules):
Core ESLint Rules (110 rules):
Import/Export Rules (6 rules):
Node.js Rules (7 rules):
Promise Rules (2 rules):
Comment Rules (7 rules):
The configuration automatically sets up TypeScript parsing:
languageOptions: {
parser, // imported from 'typescript-eslint'
parserOptions: {
projectService: true, // Automatic project detection
},
}The projectService: true option enables automatic TypeScript project detection, eliminating the need to manually specify tsconfig.json paths.
This configuration prioritizes safety over convenience:
'error' level rather than 'warn'The exported configuration object can be extended or overridden:
import love from 'eslint-config-love';
export default [
{
...love,
files: ['**/*.ts'],
rules: {
...love.rules,
// Override specific rules
'@typescript-eslint/no-unused-vars': 'warn',
},
},
];The configuration does not throw runtime errors. All validation occurs during ESLint execution. Common issues:
projectService: true option requires a valid TypeScript project (tsconfig.json)// Re-exported from @typescript-eslint/utils
interface TSESLint.FlatConfig.Config {
linterOptions?: {
reportUnusedDisableDirectives?: 'error' | 'warn' | 'off';
};
languageOptions?: {
parser?: TSESLint.FlatConfig.Parser;
parserOptions?: {
projectService?: boolean;
[key: string]: any;
};
};
plugins?: Record<string, TSESLint.FlatConfig.Plugin>;
rules?: Record<string, TSESLint.SharedConfig.RuleEntry>;
}
type TSESLint.SharedConfig.RuleEntry =
| 'error'
| 'warn'
| 'off'
| ['error' | 'warn' | 'off', ...any[]];
interface TSESLint.FlatConfig.Plugin {
rules?: Record<string, TSESLint.RuleModule<any, any>>;
processors?: Record<string, TSESLint.Processor>;
configs?: Record<string, TSESLint.FlatConfig.Config>;
}
interface TSESLint.FlatConfig.Parser {
parse(text: string, options?: any): TSESTree.Program;
parseForESLint?(text: string, options?: any): TSESLint.ESLintParseResult;
}