vuejs 和 storybook 的 Eslint 错误

问题描述

我正在使用 vuejs 和 storybook。

当我跑步时 npm storybook:serve,我收到下一个错误

但是,我没有找到我的 vscode 哪里出错了。

//eslint 错误

F: \Programas\vuejs\superviz_teste\sv - challenge\src\stories\index.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 设置

{
    "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 配置

....
....
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"]
},

//我的 vs 代码

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",max: 20 } }
  }
};

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)