@rushstack/eslint-config
Version:
A TypeScript ESLint ruleset designed for large teams and projects
72 lines • 2.74 kB
JavaScript
;
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
const eslint_plugin_1 = __importDefault(require("@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 = eslint_plugin_1.default;
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
}
]
}
}
];
module.exports = config;
//# sourceMappingURL=friendly-locals.js.map