ESlint IDE not formatting in Sibling Directory

Viewed 186

I feel like I must be missing something really simple here, but for all my searching and going over the docs, I just cannot find a solution to this problem.

I have an inherited file structure (which at the moment cannot change) that looks like this:

- Folder 1
  -Web Files Folder
- Folder 2 (root)
  - .eslintrc.js

Folder 1 and 2 are siblings of one another, my main set of js, jsx, ts and tsx are set up in the Web Files Folder, and my eslint and webpack configs, package.json and entry point files are all in Folder 2.

I cannot seem to get the IDE (in this case VS Code) to effectively lint the files within the Web Files Folder. I have tried a whole host of things, the latest of which was trying to use overrides in my .eslintrc.js file to point to the relevant directory:

module.exports = {
    env: {
        browser: true,
        es6: true,
        jest: true,
        jquery: true,
        node: true
    },
    extends: [
        'eslint:recommended',
        'eslint-config-prettier',
        'plugin:@typescript-eslint/recommended',
        'plugin:react/recommended',
        'plugin:jsx-a11y/recommended',
        'prettier',
        'prettier/@typescript-eslint'
    ],
    parser: '@typescript-eslint/parser',
    parserOptions: {
        jsx: true,
        ecmaVersion: 2020
    },
    plugins: ['@typescript-eslint', 'react', 'prettier', 'jsx-a11y', 'jest'],
    root: true,
    rules: {
        'array-callback-return': 0,
        'consistent-return': 0,
        ...
    },
    settings: {
        'import/resolver': {
            node: {
                extensions: ['.js', '.jsx', '.ts', '.tsx']
            }
        },
        react: {
            version: 'detect'
        }
    }
    overrides: [
      {
        files: ['../Folder 1/Web Files Folder/*.js', '../Folder 1/Web Files Folder/*.jsx', '../Folder 1/Web Files Folder/*.ts', '../Folder 1/Web Files Folder/*.tsx']
      },
  ]
};

This results in the error in the Eslint console: Invalid override pattern (expected relative path not containing '..')

However nothing I have tried works. I am not worried about the linting in the build, only getting the errors to appear in the IDE and resolve on save (which works perfectly if I place the files within Folder 2)

I am looking for a solution which I can use in my eslintrc.js file rather than any changes to settings in the IDE if possible. Something like

project: ['./**/*', '../Folder 1/Web Files Folder/**/*']
0 Answers
Related