BenoitZugmeyer / eslint-plugin-html

An ESLint plugin to extract and lint scripts from HTML files.
ISC License
430 stars 51 forks source link

Getting this error every time now, what is going on ? I reinstalled my es lint 2 times as well #121

Closed masiucd closed 4 years ago

masiucd commented 5 years ago

PersonalConfig': eslint-plugin-html error: It seems that eslint is not loaded. If you think this is a bug, please file a report at https://github.com/BenoitZugmeyer/eslint-plugin-html/issues In the report, please include all those informations: ESLint version: 5.16.0 ESLint path: /Users/masiuciszek/node_modules/eslint/lib/api.js Plugin version: 5.0.5 Plugin inclusion paths: /Users/masiuciszek/node_modules/eslint-plugin-html/src/index.js,

what should I do?

BenoitZugmeyer commented 5 years ago

Hi @masiuciszek, thank you for reaching out. I can't reproduce your issue. You only included the top lines of the generated bug report. Could you tell me a bit more? What's your Node.JS version? How do you use eslint (editor plugin, command line arguments...)? Are you using other ESLint plugins?

xdestiny commented 5 years ago

Not OP but facing the same issue. I get this error in the latest PHP Storm on Windows when developing Vue.js applications in a .vue file where HTML code and JS is mixed. I am not clear if this started happening since updating PHP Storm last or the jslint plugin being updated or a change in the google linting rules.

Error: eslint-plugin-html error: It seems that eslint is not loaded. If you think it is a bug, please file a report at https://github.com/BenoitZugmeyer/eslint-plugin-html/issues
    at findESLintModules ([redacted]\node_modules\eslint-plugin-html\src\index.js:49:11)
    at preprocess ([redacted]\node_modules\eslint-plugin-html\src\index.js:100:24)
    at Linter._verifyWithProcessor ([redacted]\node_modules\eslint\lib\linter\linter.js:1250:30)
    at Linter._verifyWithConfigArray ([redacted]\node_modules\eslint\lib\linter\linter.js:1222:25)
    at Linter.verify ([redacted]\node_modules\eslint\lib\linter\linter.js:1184:25)
    at Linter.verifyAndFix ([redacted]\node_modules\eslint\lib\linter\linter.js:1374:29)
    at verifyText ([redacted]\node_modules\eslint\lib\cli-engine\cli-engine.js:231:48)
    at CLIEngine.executeOnText ([redacted]\node_modules\eslint\lib\cli-engine\cli-engine.js:871:26)
    at ESLintPlugin.invokeESLint (C:\Program Files\JetBrains\PhpStorm 2019.1.3\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint-plugin.js:93:26)
    at ESLintPlugin.getErrors (C:\Program Files\JetBrains\PhpStorm 2019.1.3\plugins\JavaScriptLanguage\languageService\eslint\bin\eslint-plugin.js:67:21)

I load these: "eslint": "^6.5.1", "eslint-config-google": "^0.7.1", "eslint-loader": "^1.6.1", "eslint-plugin-html": "^1.7.0", "eslint-plugin-vue": "^5.2.3",

This is my config

module.exports = {
    parser: "babel-eslint",
    extends: [
        // "eslint:recommended",
        "plugin:vue/recommended",
        "google"
    ],
    parserOptions: {
        ecmaVersion: 6,
        ecmaFeatures: {
            experimentalObjectRestSpread: true,
            jsx: true
        },
        sourceType: 'module'
    },
    plugins: ['vue', 'html'],
    env: {
        es6: true,
        node: true
    },
    globals: {
        Vue: true,
        window: true,
        Laravel: true,
        jquery: true,
        $: true,
        document: true,
        FormData: true,
    },
    // Fixing some extremely annoying rules
    rules: {
        // console.logs give warnings, not errors
        'no-console': 1,
        // same with max-len
        'max-len': [1, 100],
        // we want empty spaces for better formatting
        'no-multi-spaces': 0,
        // key spaces
        'key-spacing' : 0,
        // we don't use jsdoc
        'require-jsdoc' : 0,
        //
        'linebreak-style': 0,
    }
};
BenoitZugmeyer commented 5 years ago

Thank you for reaching out. ESLint 6+ support is only available from eslint-plugin-html 6.0.0. Could you try to update the plugin?

xdestiny commented 5 years ago

Worked for me. In addition, I had to move the parse definition to the parserOptions as described at https://vuejs.github.io/eslint-plugin-vue/user-guide/#editor-integrations

parserOptions: {
        parser: "babel-eslint",
BenoitZugmeyer commented 5 years ago

Are you using eslint-plugin-html for linting .vue files? If so, you should not. Just remove the html plugin, it should work with the Vue plugin alone.

xdestiny commented 5 years ago

Thanks, I will do that. In this instance there are also some non-vue html templates in the project so it makes sense to keep around and I don't see a direct problem since there is no html usage in javascript.

BenoitZugmeyer commented 4 years ago

Closing this. For those still needing assistance, feel free to open a new issue.