import/extensions breaks when a scoped package's scope is just `@`
See original GitHub issueIn a Vue application, using version with packages:
"eslint": "^5.2.0",
"eslint-config-airbnb-base": "^13.2.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-vue": "^5.2.3",
and an eslint.js of:
module.exports = {
root: true,
env: {
node: true,
},
extends: ['plugin:vue/essential', 'airbnb-base'],
rules: {
'linebreak-style': 0,
'no-console': 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
'padded-blocks': 0,
'no-param-reassign': 0,
'import/no-unresolved': 0,
'import/prefer-default-export': 0,
'max-len': 0,
'object-curly-newline': ['error', { ObjectPattern: 'never' }],
// 'vue/html-closing-bracket-newline': ['error', {
// singleline: 'never',
// multiline: 'never',
// }],
},
parserOptions: {
parser: 'babel-eslint',
},
};
In a .vue file, when trying to do an import of a .js file, the eslint plugin can’t decide if the .js extension is needed or not:
This:
import router from '@/router';
shows:
Missing file extension for "@/router"
If I change it to:
import router from '@/router.js';
I now get:
Unexpected use of file extension "js" for "@/router.js"
So which do you want?!?
FYI, the jsconfig.json is:
{
"include": [
"./src/**/*"
],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": [
"src/*"
]
}
}
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:21 (14 by maintainers)
Top Results From Across the Web
import/extensions breaks when a scoped package's ... - GitHub
In a Vue application, using version with packages: "eslint": ... import/extensions breaks when a scoped package's scope is just @ #1598.
Read more >scope - npm Docs
The scope folder ( @myorg ) is simply the name of the scope preceded by an @ symbol, and can contain any number...
Read more >Using GitHub Packages Registry with Unity Package Manager
Even if your Github Packages registry-based scoped registry is ... Unity decides to use dot notation as the scope, but other NPM based ......
Read more >npm - Understanding Scoped Packages - Nitay Neeman's Blog
This article explains what scopes are in regard to npm packages - focusing on how to create, publish and install them.
Read more >TypeScript: Scoped npm packages with type definitions on ...
Changing the import to import { SetupMethod } from '@feathersjs/feathers'; fixes compilation but breaks all WebStorm features like code completion, detection/ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ljharb confirmed, it fixes the issue
So far, this version looks like it’s fixed the issue. I’ll do some more testing but 👍