0

I´m working on a Vue3 TypeScript application.

I have activated the checkbox in PhpStorm's ESLint settings to "Run 'eslint --fix' on save" but it does not work.

After a long search for that I only found a https://github.com/microsoft/vscode-eslint/issues/609#issuecomment-460554105 for Visual Studio Code

.eslintrc.js

module.exports = {
    root: true,
    parser: "vue-eslint-parser",
    parserOptions: {
        ecmaVersion: 2021,
        parser: "@typescript-eslint/parser",
        sourceType: "module"
    },
    plugins: [
        '@typescript-eslint',
    ],
    env: {
        node: true,
        es6: true,
    },
    extends: [
        "eslint:recommended",
        "plugin:vue/vue3-recommended",
        'plugin:@typescript-eslint/recommended',
        "prettier"
    ],
    rules: {
        // override/add rules settings here, such as:
        // 'vue/no-unused-vars': 'error'
    },
};

Hope someone can help me to get it working in PhpStorm.

5
  • Does it work if you change a file and then select File > Save All with the mouse (i.e. when not using keyboard shortcuts)? Check Settings | Keymap, Main Menu | File | Save All - what shortcut is assigned to this action? Commented Feb 7, 2022 at 11:11
  • I always use ctrl + S which is the shortcut for File > Save All. It does not work. Commented Feb 7, 2022 at 11:29
  • Once more: does it work if you change a file and then select File > Save All with the mouse (i.e. when not using any keyboard shortcuts)? Commented Feb 7, 2022 at 13:11
  • No is the awnser (because i have to type at least some chars but the word "no" is to short) Commented Feb 7, 2022 at 13:55
  • does the Fix ESLint problems right-click menu action work? Commented Feb 7, 2022 at 15:02

1 Answer 1

1

Ok, I found a Solution for this, the Problem was that the official by prettier provided eslint extension didn´t work, after isntalling eslint-plugin-prettier and changing my .eslintrc.js file to

module.exports = {
    root: true,
    parser: "vue-eslint-parser",
    parserOptions: {
        ecmaVersion: 2021,
        parser: "@typescript-eslint/parser",
        sourceType: "module",
    },
    plugins: ["@typescript-eslint", "prettier"],
    env: {
        node: true,
        es6: true,
    },
    extends: [
        "eslint:recommended",
        "plugin:vue/vue3-recommended",
        "plugin:@typescript-eslint/recommended",
        "plugin:prettier/recommended",
    ],
    rules: {
        // override/add rules settings here, such as:
        // 'vue/no-unused-vars': 'error'
    },
};

atleast it works now.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.