hedgedoc/.eslintrc.js
David Mehren 4d60686591
Run prettier format checks in ESLint
This enables the prettier ESLint plugin.
In contrast to the prettier ESLint config (which is already enabled),
the plugin also runs checks against prettiers format rules
as part of ESLint.
This enables instant feedback in the editor,
when code violates the format rules and allows for quick-fix actions.

See also https://github.com/prettier/eslint-plugin-prettier#recommended-configuration

Signed-off-by: David Mehren <git@herrmehren.de>
2021-08-29 19:54:56 +02:00

83 lines
2.2 KiB
JavaScript

/* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: CC0-1.0
*/
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
},
overrides: [
{
files: ['test/**', 'src/**/*.spec.ts'],
extends: ['plugin:jest/recommended'],
rules: {
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/require-await': 'off',
'jest/unbound-method': 'error',
'jest/expect-expect': [
'error',
{
assertFunctionNames: ['expect', 'request.**.expect'],
},
],
'jest/no-standalone-expect': [
'error',
{
additionalTestBlockFunctions: ['afterEach', 'beforeAll'],
},
],
},
},
],
plugins: ['@typescript-eslint', 'jest', 'eslint-plugin-local-rules'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:prettier/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
rules: {
'local-rules/correct-logger-context': 'error',
'func-style': ['error', 'declaration'],
'@typescript-eslint/no-unused-vars': [
'warn',
{ argsIgnorePattern: '^_+$' },
],
'@typescript-eslint/explicit-function-return-type': 'warn',
'no-return-await': 'off',
'@typescript-eslint/return-await': ['error', 'always'],
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'default',
format: ['camelCase'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
},
{
selector: 'enumMember',
format: ['UPPER_CASE'],
},
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
},
{
selector: 'typeLike',
format: ['PascalCase'],
},
],
},
};