Search code examples
typescriptnext.jsnode-sasstypescript-eslint

how to use sass for next.js


I making Next.js project for tyepscript

i tried install sass

but error occered

Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: 
The file must be included in at least one of the projects provided.

add inclued project next.config.js

but error no fix

my .eslintrc.js code there

module.exports = {
  env: {
    browser: true,
    es6: true,
  },
  extends: [
    'eslint:recommended',
    'plugin:@typescript-eslint/recommended'
  ],
  globals: {
    Atomics: 'readonly',
    SharedArrayBuffer: 'readonly',
  },
  parser: '@typescript-eslint/parser',
  parserOptions: {
    ecmaFeatures: {
      jsx: true,
    },
    project: [
      './tsconfig.json'
    ],
    sourceType: 'module',
  },
  plugins: [
    'react',
    '@typescript-eslint',
  ],
  rules: {
    '@typescript-eslint/explicit-function-return-type': 'off',
    '@typescript-eslint/explicit-member-accessibility': 'off',
    'indent': 'off',
    '@typescript-eslint/indent': ['error', 2],
    '@typescript-eslint/no-unnecessary-type-assertion': 'error',
    'eol-last': ['error', 'always'],
    'func-style': ['error', 'expression', {
      allowArrowFunctions: true
    }],
    'newline-before-return': 'error',
    'no-dupe-class-members': 'error',
    'no-var': 'error',
    'object-shorthand': ['error', 'always'],
    'prefer-arrow-callback': 'error',
    'prefer-const': 'error',
    'prefer-spread': 'error',
    'require-yield': 'error'
  },
};

As long as you look at the formula, it seems to be working without problems, and I think that eslint is the cause, but hasn't solved the problem, is there anyone who knows about this problem?

Thank you


Solution

  • Using createDefaultProgram: true can be the temporary solution in parserOptions until next release.

    parserOptions:  {
        ...,
        createDefaultProgram: true,        
    },
    

    And it is known issue.

    https://github.com/typescript-eslint/typescript-eslint/issues/967