7

Here's an example of an error I am receiving, which I do not know how to fix:

// example.css

body {
  height: 100%;
}

this would return the following error in the terminal when running eslint:

1:5 error Parsing error: ';' expected

Here are my eslintrc and prettierrc configurations, thank you for the help:

// eslintrc.js

module.exports = {
    env: {
        browser: true,
        jest: true,
        node: true,
        es6: true,
    },
    parser: '@typescript-eslint/parser',
    plugins: ['@typescript-eslint'],
    extends: [
        'airbnb',
        'prettier',
        'prettier/react',
        'prettier/@typescript-eslint',
        'plugin:@typescript-eslint/recommended',
    ],
    parserOptions: {
        ecmaVersion: 2018,
        sourceType: 'module',
        ecmaFeatures: {
            jsx: true,
        },
    },
    rules: {
        'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
        'react/jsx-filename-extension': ['warn', { extensions: ['.tsx', '.jsx'] }],
        '@typescript-eslint/interface-name-prefix': ['error', { prefixWithI: 'always' }]
    },
    settings: {
        react: {
            version: 'detect',
        },
        'import/extensions': ['.js', '.jsx', '.ts', '.tsx'],
        'import/parsers': {
            '@typescript-eslint/parser': ['.ts', '.tsx'],
        },
        'import/resolver': {
            node: {
                extensions: ['.js', '.jsx', '.ts', '.tsx'],
                moduleDirectory: ['node_modules', 'src'],
            },
        },
    },
};
// prettierrc.js

module.exports =  {
    semi:  true,
    trailingComma:  'all',
    singleQuote:  true,
    printWidth:  120,
    tabWidth:  2,
};
1

1 Answer 1

7

After a bit more research, I found out that my eslint command was the issue:

yarn eslint src/**

This included .css, .json, etc. files even though my eslintrc was correctly configured. By switching to this function, the issue no longer occurs:

yarn eslint --ext js,jsx,ts,tsx src

Sign up to request clarification or add additional context in comments.

1 Comment

not working for me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.