ESLint no-unused-expressions on json file

Viewed 226

So, I'm using vite, eslint and prettier for my React + Typescript project, and when I run eslint --ext .js,.jsx,.ts,.tsx,.json --ignore-path .eslintignore ., it fails on:

eslint error

this is the file:

{
    "compilerOptions": {
        "composite": true,
        "module": "esnext",
        "moduleResolution": "node"
    },
    "include": ["vite.config.ts"]
}

PS.: I want it to be formatted that way!

This is my .eslintrc.js and .prettierrc.js respectively:

// .eslintrc.js
module.exports = {
    env: {
        browser: true,
        es2021: true
    },
    extends: ['plugin:react/recommended', 'airbnb', 'prettier'],
    parser: '@typescript-eslint/parser',
    parserOptions: {
        ecmaFeatures: {
            jsx: true
        },
        ecmaVersion: 12,
        sourceType: 'module'
    },
    plugins: ['react', '@typescript-eslint', 'prettier'],
    settings: {
        'import/resolver': {
            node: {
                extensions: ['.js', '.jsx', '.ts', '.tsx']
            }
        }
    },
    ignorePatterns: [
        'node_modules/',
        'coverage/',
        '.editorconfig',
        'package.json',
        'tsconfig.json'
    ],
    rules: {
        'react/jsx-filename-extension': 'off',
        'react/function-component-definition': 'off',
        'jsx-a11y/anchor-is-valid': 'off',
        'import/extensions': ['error', 'never'],
        'import/prefer-default-export': 'off',
        'import/first': 'off',
        'linebreak-style': ['error', 'unix'],
        'lines-between-class-members': 'off',
        'no-plusplus': 'off',
        indent: ['error', 4],
        'comma-dangle': ['error', 'never'],
        'class-methods-use-this': 'off',
        semi: 'off',
        'import/no-extraneous-dependencies': [
            'error',
            {
                devDependencies: ['**/*.test.ts', '**/*.test.js', 'vite.config.ts']
            }
        ]
    }
};
// .prettierrc.js
module.exports = {
    singleQuote: true,
    arrowParens: 'always',
    semi: true,
    printWidth: 100,
    tabWidth: 4,
    trailingComma: 'none',
    endOfLine: 'lf'
};

Oh, also, for prettier, everything is fine, that file doesn't trigger any errors on prettier. And I also did try using the eslint --fix cli, but it throws the exact same error...

What do I need to change?

0 Answers
Related