Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
311 views
in Technique[技术] by (71.8m points)

vue.js - Eslint errors with vuejs and storybook

I am using vuejs with storybook.

When I run npm storybook:serve, I get the next errors.

But, I am not finding where my vscode is wrong.

//eslint error

F: Programasvuejssuperviz_testesv - challengesrcstoriesindex.stories.js
  1:1  error  Expected linebreaks to be 'CRLF' but found 'LF'                  linebreak-style
  1:1  error  Too many blank lines at the beginning of file. Max of 0 allowed  no-multiple-empty-lines
  2: 1  error  Expected indentation of 0 spaces but found 6                     indent

//vscode settings

{
    "editor.formatOnType": true,
    "window.zoomLevel": 0,
    "[typescript]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "[vue]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[html]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[javascript]": {
      "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "search.exclude": {
      "**/dist": true
    },
    "eslint.format.enable": true,
    "editor.formatOnSave": true,
    "vetur.ignoreProjectWarning": true,
    "json.maxItemsComputed": 9000
  }
  

// .eslint.rc config

....
....
rules: {
        "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
        "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
        "linebreak-style": 0,
        quotes: [2, "double"],
        "no-multiple-empty-lines": ["error", { max: 2, maxBOF: 0, maxEOF: 0 }],
        "import/no-extraneous-dependencies": ["error", { devDependencies: true }],
        "comma-dangle": ["error", "never"],
        "arrow-parens": [2, "as-needed"]
},

//my vs code

import { withKnobs, text } from "@storybook/addon-knobs";
import { action } from "@storybook/addon-actions";
import BaseButton from "../components/BaseButton.vue";

export default {
  component: BaseButton,
  title: "Form/Button",
  decorators: [() => "<section ><story/></section>", withKnobs]
};
export const withText = () => ({
  props: {
    text: { default: text("Button Text", "Botoncito ") }
  },

  render() {
    return <BaseButton onClick={action("On click!")} text={this.text}></BaseButton>;
  }
});

export const withSlot = () => ({
  render() {
    return (
      <BaseButton>
        <span className="text-xl">Slot</span>
      </BaseButton>
    );
  }
});

withText.story = {
  decorators: [() => "<section><story/></section>"],
  argTypes: {
    text: { control: { type: "range", min: 0, max: 20 } },
    isLoading: { control: { type: "boolean", min: 0, max: 20 } }
  }
};
question from:https://stackoverflow.com/questions/65889550/eslint-errors-with-vuejs-and-storybook

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...