105 lines
2.8 KiB
TypeScript
105 lines
2.8 KiB
TypeScript
import eslint from '@eslint/js';
|
|
import tseslint from 'typescript-eslint';
|
|
import stylistic from '@stylistic/eslint-plugin';
|
|
import nodePlugin from 'eslint-plugin-n';
|
|
|
|
export default tseslint.config(
|
|
eslint.configs.recommended,
|
|
nodePlugin.configs['flat/recommended-script'],
|
|
...tseslint.configs.strictTypeChecked,
|
|
...tseslint.configs.stylisticTypeChecked,
|
|
{
|
|
ignores: ['**/node_modules/*', '**/*.mjs', '**/*.js', 'src/mapper.ts'],
|
|
},
|
|
{
|
|
languageOptions: {
|
|
parserOptions: {
|
|
project: './tsconfig.json',
|
|
warnOnUnsupportedTypeScriptVersion: false,
|
|
},
|
|
},
|
|
},
|
|
{
|
|
settings: {
|
|
n: {
|
|
// Specify the Node.js version for eslint-plugin-n
|
|
// Node.js 20+ has fetch API stable
|
|
version: '21.0.0',
|
|
},
|
|
},
|
|
},
|
|
{
|
|
plugins: {
|
|
'@stylistic/js': stylistic,
|
|
'@stylistic/ts': stylistic,
|
|
},
|
|
},
|
|
{
|
|
files: ['**/*.ts'],
|
|
},
|
|
{
|
|
rules: {
|
|
'@typescript-eslint/explicit-member-accessibility': 'warn',
|
|
'@typescript-eslint/no-misused-promises': 0,
|
|
'@typescript-eslint/no-floating-promises': 0,
|
|
'@typescript-eslint/no-confusing-void-expression': 0,
|
|
'@typescript-eslint/no-unnecessary-condition': 0,
|
|
'@typescript-eslint/restrict-template-expressions': [
|
|
'error',
|
|
{ allowNumber: true },
|
|
],
|
|
'@typescript-eslint/restrict-plus-operands': [
|
|
'warn',
|
|
{ allowNumberAndString: true },
|
|
],
|
|
'@typescript-eslint/no-unused-vars': 'warn',
|
|
'@typescript-eslint/no-unsafe-enum-comparison': 0,
|
|
'@typescript-eslint/no-unnecessary-type-parameters': 0,
|
|
'@stylistic/js/no-extra-semi': 'warn',
|
|
'max-len': [
|
|
'warn',
|
|
{
|
|
code: 80,
|
|
},
|
|
],
|
|
'@stylistic/ts/semi': ['warn', 'always'],
|
|
'@stylistic/ts/member-delimiter-style': [
|
|
'warn',
|
|
{
|
|
multiline: {
|
|
delimiter: 'comma',
|
|
requireLast: true,
|
|
},
|
|
singleline: {
|
|
delimiter: 'comma',
|
|
requireLast: false,
|
|
},
|
|
overrides: {
|
|
interface: {
|
|
singleline: {
|
|
delimiter: 'semi',
|
|
requireLast: false,
|
|
},
|
|
multiline: {
|
|
delimiter: 'semi',
|
|
requireLast: true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
],
|
|
'@typescript-eslint/no-non-null-assertion': 0,
|
|
'@typescript-eslint/no-unused-expressions': 'warn',
|
|
'comma-dangle': ['warn', 'always-multiline'],
|
|
'no-console': 1,
|
|
'no-extra-boolean-cast': 0,
|
|
indent: ['warn', 2],
|
|
quotes: ['warn', 'single'],
|
|
'n/no-process-env': 1,
|
|
'n/no-missing-import': 0,
|
|
'n/no-unpublished-import': 0,
|
|
'prefer-const': 'warn',
|
|
},
|
|
},
|
|
);
|