Jackie
Jackie

Reputation: 23607

Not able to ignore Rule in Eslint

I have the following in my .eslintrc (project here https://github.com/jrgleason/jest/tree/UPGRADE)

overrides: [
...
    {
        files: [
            'e2e/__tests__/**/*',
        ],
        rules: {
            'import/no-unresolved': "off",
        },
    },
]

But when I run I see...

Code/jest/e2e/tests/haste_map_sha1.test.js 14:26 error Unable to resolve path to module 'jest-haste-map' import/no-unresolved

Why isn't it turning it off?

Upvotes: 1

Views: 1335

Answers (2)

Jackie
Jackie

Reputation: 23607

The answer was that I can't do this because of a bug in ESLINT

See here https://github.com/eslint/eslint/issues/9025

Upvotes: 0

hulkish
hulkish

Reputation: 114

It's because you're using an invalid json format:

    {
        files: [
            'e2e/__tests__/**/*',
            'packages/babel-jest/**/*.test.js',
            'packages/babel-plugin-jest-hoist/**/*.test.js',
            'packages/babel-preset-jest/**/*.test.js',
            'packages/eslint-config-fb-strict/**/*.test.js',
            'packages/eslint-plugin-jest/**/*.test.js',
            'packages/jest-changed-files/**/*.test.js',
            'packages/jest-circus/**/*.test.js',
            'packages/jest-diff/**/*.test.js',
            'packages/jest-docblock/**/*.test.js',
            'packages/jest-editor-support/**/*.test.js',
            'packages/jest/**/*.test.js',
            'packages/pretty-format/**/*.test.js',
        ],
        rules: {
            'import/no-unresolved': "off",
            'flowtype/require-valid-file-annotation': [2, 'always'],
        },
    },

These should be doublequotes.

Update: eslint supports JSON5, so try: 'import/no-unresolved': "off",

Upvotes: 1

Related Questions