dsi-icl/optimise

View on GitHub
.eslintrc.js

Summary

Maintainability
A
0 mins
Test Coverage
const jsonRules = {
    indent: [
        'error',
        4,
        {
            SwitchCase: 1,
            ignoredNodes: ['VariableDeclaration[declarations.length=0]']
        }
    ]
};

const javascriptRules = {
    ...jsonRules,
    '@nx/enforce-module-boundaries': [
        'error',
        {
            enforceBuildableLibDependency: true,
            allow: [],
            depConstraints: [
                {
                    sourceTag: '*',
                    onlyDependOnLibsWithTags: ['*']
                }
            ]
        }
    ],
    'react/style-prop-object': 'off',
    'quotes': ['error', 'single'],
    'quote-props': ['error', 'consistent-as-needed'],
    'comma-dangle': ['error', 'never'],
    'no-trailing-spaces': 'error',
    'no-extra-semi': 'error',
    'no-unused-vars': ['warn', { args: 'after-used', varsIgnorePattern: '^__unused' }],
    'semi': ['error', 'always'],
    'no-prototype-builtins': 'off',
    '@typescript-eslint/no-this-alias': 'off',
    '@typescript-eslint/camelcase': 'off',
    '@typescript-eslint/no-unused-vars': ['warn', { args: 'after-used', varsIgnorePattern: '^__unused' }],
    '@typescript-eslint/consistent-type-assertions': 'off'
};

// const typescriptRules = {
//     ...javascriptRules,
//     'no-unused-vars': 'off',
//     '@typescript-eslint/no-unused-vars': ['error', { args: 'after-used', varsIgnorePattern: '^__unused' }]
// };

module.exports = {
    root: true,
    parserOptions: {
        tsconfigRootDir: __dirname,
        ecmaVersion: 'latest'
    },
    env: {
        es6: true
    },
    ignorePatterns: ['**/*', '!**/*.json', '!**/*.js', '!**/*.ts', '!scripts', '!tools', '!.vscode'],
    plugins: ['@nx', 'jsonc'],
    overrides: [
        // {
        //     files: ['*.ts', '*.tsx'],
        //     extends: ['plugin:@nx/typescript'],
        //     rules: typescriptRules
        // },
        {
            files: ['*.js', '*.jsx'],
            extends: ['plugin:@nx/javascript'],
            rules: javascriptRules
        },
        {
            files: ['*.json'],
            parser: 'jsonc-eslint-parser',
            extends: ['plugin:jsonc/recommended-with-json'],
            rules: jsonRules
        }
    ]
};