Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linebreak error when using with nest new project #641

Open
Serpentarius13 opened this issue Jan 28, 2024 · 14 comments
Open

Linebreak error when using with nest new project #641

Serpentarius13 opened this issue Jan 28, 2024 · 14 comments

Comments

@Serpentarius13
Copy link

What version of eslint are you using?

8.42.0

What version of prettier are you using?

3.0.0

What version of eslint-plugin-prettier are you using?

5.0.0

Please paste any applicable config files that you're using (e.g. .prettierrc or .eslintrc files)

module.exports = {
  parser: '@typescript-eslint/parser',
  parserOptions: {
    tsconfigRootDir: __dirname,
    sourceType: 'module',
  },
  plugins: ['@typescript-eslint/eslint-plugin'],
  extends: [
    'plugin:@typescript-eslint/recommended',
    'plugin:prettier/recommended',
  ],
  root: true,
  env: {
    node: true,
    jest: true,
  },
  ignorePatterns: ['.eslintrc.js'],
  rules: {
    '@typescript-eslint/interface-name-prefix': 'off',
    '@typescript-eslint/explicit-function-return-type': 'off',
    '@typescript-eslint/explicit-module-boundary-types': 'off',
    '@typescript-eslint/no-explicit-any': 'off',
    'prettier/prettier': ['error', { endOfLine: 'auto' }],
  },
};

{
  "singleQuote": true,
  "trailingComma": "all",
  "endOfLine": "auto"
}

What source code are you linting?

https://github.com/Serpentarius13/nest-eslint-error.

What did you expect to happen?

Linting for endOfLine choosing should turn itself off when providing such a setting. However (im using Webstorm) even after few reloads, cache clean, npm reinstall with node_modules removal, error still happens to me. Even with all possible fixes I've looked upon, its still happening:
image

What actually happened?

Linting for EOL is not turning off and there's red underscores everywhere until I actually lint.

@JounQin
Copy link
Member

JounQin commented Jan 28, 2024

  1. Can you reproduce it with cli
  2. Did you try to reload vscode or restart vscode-eslint extension
  3. Why you think it's an issue from this plugin instead of vscode-eslint extension

@Serpentarius13
Copy link
Author

  1. Can you reproduce it with cli
  2. Did you try to reload vscode or restart vscode-eslint extension
  3. Why you think it's an issue from this plugin instead of vscode-eslint extension
  1. It happened right after I set up the project
  2. Yes, multiple times
  3. It isnt tied to IDE, the same error happens in WebStorm and Vscode both

@JounQin
Copy link
Member

JounQin commented Jan 28, 2024

  1. You didnt answer my question

closed accidentally.

@JounQin JounQin closed this as completed Jan 28, 2024
@JounQin JounQin reopened this Jan 28, 2024
@Serpentarius13
Copy link
Author

  1. You didnt answer my question

closed accidentally.

  1. Yes, it is reproducible with nest new command

@JounQin
Copy link
Member

JounQin commented Jan 30, 2024

What is nest new? Please run eslint cli directly.

@Serpentarius13
Copy link
Author

nest is a cli for Nest.js, a Node framework. I've created a new node project with latest versions of packages and this config:

module.exports = {
    parser: '@typescript-eslint/parser',
    parserOptions: {
      project: 'tsconfig.json',
      tsconfigRootDir: __dirname,
      sourceType: 'module',
    },
    plugins: ['@typescript-eslint/eslint-plugin'],
    extends: [
      'plugin:@typescript-eslint/recommended',
      'plugin:prettier/recommended',
    ],
    root: true,
    env: {
      node: true,
      jest: true,
    },
    ignorePatterns: ['.eslintrc.js'],
    rules: {
      '@typescript-eslint/interface-name-prefix': 'off',
      '@typescript-eslint/explicit-function-return-type': 'off',
      '@typescript-eslint/explicit-module-boundary-types': 'off',
      '@typescript-eslint/no-explicit-any': 'off',
    },
  };

  

and .prettierrc:

{
    "endOfLine": "auto",
    "singleQuote": true,
    "trailingComma": "all"
}

With it, there's a lot of red trails in my code:

image

But when I set option of endOfLine setting to auto ('prettier/prettier': ['error', {"endOfLine": "auto"}]), I get it still, only on the last line:

image

CLI output:

image

@JounQin
Copy link
Member

JounQin commented Jan 30, 2024

Don't paste codes here, how to reproduce in your reproduction repo?

@Serpentarius13
Copy link
Author

Don't paste codes here, how to reproduce in your reproduction repo?

Don't you have any errors when you open up the project and install dependencies?

@JounQin
Copy link
Member

JounQin commented Jan 31, 2024

I need what commands to reproduce before involving.

@Serpentarius13
Copy link
Author

I need what commands to reproduce before involving.

npm i is enough I guess

@JounQin
Copy link
Member

JounQin commented Jan 31, 2024

eslint. next?

@Serpentarius13
Copy link
Author

eslint. next?

Yep

@CarlosRivera4726
Copy link

nest is a cli for Nest.js, a Node framework. I've created a new node project with latest versions of packages and this config:

module.exports = {
    parser: '@typescript-eslint/parser',
    parserOptions: {
      project: 'tsconfig.json',
      tsconfigRootDir: __dirname,
      sourceType: 'module',
    },
    plugins: ['@typescript-eslint/eslint-plugin'],
    extends: [
      'plugin:@typescript-eslint/recommended',
      'plugin:prettier/recommended',
    ],
    root: true,
    env: {
      node: true,
      jest: true,
    },
    ignorePatterns: ['.eslintrc.js'],
    rules: {
      '@typescript-eslint/interface-name-prefix': 'off',
      '@typescript-eslint/explicit-function-return-type': 'off',
      '@typescript-eslint/explicit-module-boundary-types': 'off',
      '@typescript-eslint/no-explicit-any': 'off',
    },
  };

  

and .prettierrc:

{
    "endOfLine": "auto",
    "singleQuote": true,
    "trailingComma": "all"
}

With it, there's a lot of red trails in my code:

image

But when I set option of endOfLine setting to auto ('prettier/prettier': ['error', {"endOfLine": "auto"}]), I get it still, only on the last line:

image

CLI output:

image

I solve this issue writing this in my .eslintrc.js file, I paste all code:

module.exports = {
  parser: '@typescript-eslint/parser',
  parserOptions: {
    project: 'tsconfig.json',
    tsconfigRootDir: __dirname,
    sourceType: 'module',
  },
  plugins: ['@typescript-eslint/eslint-plugin'],
  extends: [
    'plugin:@typescript-eslint/recommended',
    'plugin:prettier/recommended',
  ],
  root: true,
  env: {
    node: true,
    jest: true,
  },
  ignorePatterns: ['.eslintrc.js'],
  rules: {
    '@typescript-eslint/interface-name-prefix': 'off',
    '@typescript-eslint/explicit-function-return-type': 'off',
    '@typescript-eslint/explicit-module-boundary-types': 'off',
    '@typescript-eslint/no-explicit-any': 'off',
    "prettier/prettier": ["error", {"endOfLine": "auto"}],
  },
};

@ratishjain12
Copy link

this works perfectly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants