@rushstack/eslint-config
Version:
A TypeScript ESLint ruleset designed for large teams and projects
67 lines • 2.55 kB
JavaScript
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import typescriptEslintPlugin from '@typescript-eslint/eslint-plugin';
// The third-party @typescript-eslint plugin does not present itself as an `ESLint.Plugin` (its typescript-eslint
// `RuleModule` types are intentionally not assignable to ESLint's `RuleDefinition`), so widen it through
// `object` to reference it in a flat-config `plugins` map.
const typescriptEslintPluginAsEslintPlugin = typescriptEslintPlugin;
const config = [
{
files: ['**/*.ts', '**/*.tsx'],
plugins: {
'@typescript-eslint': typescriptEslintPluginAsEslintPlugin
},
rules: {
'@rushstack/typedef-var': 'off', // <--- disabled by the mixin
'@typescript-eslint/typedef': [
'warn',
{
arrayDestructuring: false,
arrowParameter: false,
memberVariableDeclaration: true,
objectDestructuring: false,
parameter: true,
propertyDeclaration: true,
variableDeclaration: true, // <--- reenabled by the mixin
variableDeclarationIgnoreFunction: true
}
]
}
},
{
files: [
// Test files
'**/*.test.ts',
'**/*.test.tsx',
'**/*.spec.ts',
'**/*.spec.tsx',
// Facebook convention
'**/__mocks__/**/*.ts',
'**/__mocks__/**/*.tsx',
'**/__tests__/**/*.ts',
'**/__tests__/**/*.tsx',
// Microsoft convention
'**/test/**/*.ts',
'**/test/**/*.tsx'
],
plugins: {
'@typescript-eslint': typescriptEslintPluginAsEslintPlugin
},
rules: {
'@typescript-eslint/typedef': [
'warn',
{
arrayDestructuring: false,
arrowParameter: false,
memberVariableDeclaration: true,
objectDestructuring: false,
parameter: true,
propertyDeclaration: true,
variableDeclaration: false, // <--- special case for test files
variableDeclarationIgnoreFunction: true
}
]
}
}
];
//# sourceMappingURL=friendly-locals.js.map