question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'ImportDeclaration': 'never', is not enforced.

See original GitHub issue

Tell us about your environment

  • ESLint Version: 6.7.2
  • Node Version: 12.19.0
  • npm Version: 6.14.10

What parser (default, @babel/eslint-parser, @typescript-eslint/parser, etc.) are you using? default

Please show your full configuration:

Configuration
module.exports = {
  root: true,
  env: {
    node: true,
  },
  extends: [
    'plugin:vue/vue3-recommended',
    '@vue/typescript/recommended',
  ],
  parserOptions: {
    ecmaVersion: 2020,
  },
  ignorePatterns: ['**/models/*.*'],
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    '@typescript-eslint/indent': [
      'error',
      2,
    ],
    '@typescript-eslint/ban-ts-ignore': 0,
    'linebreak-style': [
      'error',
      'unix',
    ],
    'quotes': [
      'error',
      'single', {
        'allowTemplateLiterals': true,
      },
    ],
    'semi': [
      'error',
      'never',
    ],
    'space-before-function-paren': [
      'error',
      'always',
    ],
    'object-curly-spacing': [
      'error',
      'always',
    ],
    'object-curly-newline': ['error', {
      'ObjectExpression': 'always',
      'ObjectPattern': { 'multiline': true },
      'ImportDeclaration': 'never',
      'ExportDeclaration': { 'multiline': true, 'minProperties': 2 }
    }],
    'comma-dangle': [
      'error',
      {
        'arrays': 'always-multiline',
        'objects': 'always-multiline',
        'imports': 'always-multiline',
        'exports': 'always-multiline',
        'functions': 'never',
      },
    ],
  },
  overrides: [
    {
      files: [
        '**/__tests__/*.{j,t}s?(x)',
        '**/tests/unit/**/*.spec.{j,t}s?(x)',
      ],
      env: {
        jest: true,
      },
    },
  ],
}

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

This is in a .vue SFC, within the script tag.

import { defineComponent, ref,
  PropType } from 'vue'

ESlint is ran from within VSCode.

What did you expect to happen? The import to not allow line breaks, because 'ImportDeclaration': 'never', is set.

What actually happened? Please include the actual, raw output from ESLint. Line breaks aren’t throwing an error.

Are you willing to submit a pull request to fix this bug? I have no knowledge of eslint internals, but sure, if I can help, more than willing to!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mdjermanoviccommented, Feb 2, 2021

I think it would be best to say “after” and “before”, like in rule details of array-bracket-newline.

0reactions
arminyahyacommented, Feb 2, 2021

I’m going to do this, give me one day.

Read more comments on GitHub >

github_iconTop Results From Across the Web

All imports in import declaration are unused. Components ...
All imports in import declaration are unused. ... That message just means that you're not using the components you have imported.
Read more >
object-curly-newline - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Confirm that the path in the <Import> declaration is correct ...
Hello I m getting this error with my visual studio 2012 premium. whenever I m trying to open asp.net mvc 4 templete an...
Read more >
Documentation - TypeScript 3.8
import type only imports declarations to be used for type annotations and declarations. It always gets fully erased, so there's no remnant of...
Read more >
Chapter 7. Packages and Modules - Oracle Help Center
The scope of the type(s) or member(s) introduced by an import declaration specifically does not include other compilation units in the same package,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found