@vulog/aima-user
Version: 
113 lines (112 loc) • 4.52 kB
JavaScript
module.exports = {
    parser: '@typescript-eslint/parser',
    parserOptions: {
        // Indicates the location of the TypeScript configuration file
        project: 'tsconfig.json',
        // Sets the root directory for the TypeScript configuration
        tsconfigRootDir: __dirname,
        // Specifies the version of ECMAScript syntax to be used
        ecmaVersion: 'latest',
        // Indicates the type of source code (script or module)
        sourceType: 'module',
    },
    plugins: ['@typescript-eslint', 'prettier', 'import'],
    extends: [
        'airbnb-base',
        'airbnb-typescript/base',
        'plugin:@typescript-eslint/recommended',
        'prettier',
        'plugin:prettier/recommended',
    ],
    root: true,
    env: {
        es6: true,
        node: true,
    },
    ignorePatterns: [
        '/dist/**/*', // Ignore built files.
        '.eslintrc.js',
        '**/*.test.ts',
    ],
    rules: {
        // Configures the Prettier integration with ESLint
        'prettier/prettier': ['error', { endOfLine: 'auto' }],
        // Disables the rule requiring an 'I' prefix for interfaces
        '@typescript-eslint/interface-name-prefix': 'off',
        // Configures the naming conventions for various code constructs
        '@typescript-eslint/naming-convention': [
            // ... various naming convention configurations ...
            'error',
            // Allows any naming format for destructured variables
            {
                selector: 'variable',
                modifiers: ['destructured'],
                format: null,
            },
            // Requires strict camelCase for function names
            {
                selector: 'function',
                format: ['strictCamelCase'],
            },
            // Requires boolean variables to have one of the specified prefixes
            {
                selector: 'variable',
                format: null,
                types: ['boolean'],
                prefix: ['is', 'should', 'has', 'can', 'did', 'will'],
            },
            // Requires enum names to have a strict PascalCase format
            {
                selector: 'enum',
                format: ['StrictPascalCase'],
            },
        ],
        'import/extensions': 'off',
        // Disables the rule requiring explicit return types for functions
        '@typescript-eslint/explicit-function-return-type': 'off',
        // Disables the rule requiring explicit boundary types for modules
        '@typescript-eslint/explicit-module-boundary-types': 'off',
        // Disables the rule prohibiting the use of 'any' type
        '@typescript-eslint/no-explicit-any': 'off',
        // Disables the rule detecting unused variables
        'no-unused-vars': 0,
        // Disables the rule disallowing named exports used as a default export
        'import/no-named-as-default': 0,
        // Configures the order and formatting of import statements
        'import/order': [
            // ... import order configuration ...
            'error',
            {
                // Configure the alphabetization settings
                alphabetize: {
                    // Enforce ascending alphabetical order
                    order: 'asc',
                    // Do not ignore the case while sorting
                    caseInsensitive: false,
                },
                // Enforce newlines between different groups and inside groups of imports
                'newlines-between': 'always-and-inside-groups',
                // Warn when there is an import statement that is not part of any group
                warnOnUnassignedImports: true,
            },
        ],
        // Configures the rule detecting extraneous dependencies
        'import/no-extraneous-dependencies': [
            // ... extraneous dependencies configuration ...
            'error',
            {
                // Specify the file patterns where devDependencies imports are allowed
                devDependencies: [
                    // Allow devDependencies imports in test and spec files
                    '**/*.test.{ts,js}',
                    '**/*.spec.{ts,js}',
                    // Allow devDependencies imports in the 'test' folder
                    './test/**.{ts,js}',
                    // Allow devDependencies imports in the 'scripts' folder
                    './scripts/**/*.{ts,js}',
                ],
            },
        ],
        'import/prefer-default-export': 'off',
    },
};