相关疑难解决方法(0)

关闭特定文件的eslint规则

是否可以关闭整个文件的eslint规则?像这样的东西:

// eslint-disable-file no-use-before-define 
Run Code Online (Sandbox Code Playgroud)

(类似于eslint-disable-line.)它经常发生在我身上,在某个文件中,我打破了许多地方的特定规则,对于该文件被认为是正常的,但我不想禁用整个项目的规则,我也不想禁用该特定文件的其他规则.

javascript configuration lint eslint

324
推荐指数
16
解决办法
16万
查看次数

ESLint解析错误:意外的令牌

使用此代码:

import React from 'react';
import { Link } from 'react-router';
import { View, NavBar } from 'amazeui-touch';

import * as Pages from '../components';

const {  Home, ...Components } = Pages;
Run Code Online (Sandbox Code Playgroud)

我得到这个eslint错误:

7:16  error  Parsing error: Unexpected token .. Why?
Run Code Online (Sandbox Code Playgroud)

这是我的eslint配置:

{
  "extends": "airbnb",
  "rules": {
    /* JSX */
    "react/prop-types": [1, {
      "ignore": ["className", "children", "location", "params", "location*"]
    }],
    "no-param-reassign": [0, {
      "props": false
    }],
    "prefer-rest-params": 1,
    "arrow-body-style": 0,
    "prefer-template": 0,
    "react/prefer-stateless-function": 1,
    "react/jsx-no-bind": [0, {
      "ignoreRefs": false,
      "allowArrowFunctions": false, …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs eslint

124
推荐指数
12
解决办法
14万
查看次数

神秘的ESLint解析错误

在以下代码的第4行,ESLint给我一个解析错误说:

意外的令牌=

我想知道为什么会这样?代码运行正常.我究竟做错了什么?

import { Component, PropTypes } from 'react';

export default class MainApp extends Component {
  static propTypes = {
    children: PropTypes.any.isRequired
  }

  componentWillMount() {
    require('./styles/main.styl');
  }

  render() {
    return (
      <div>
        {this.props.children}
      </div>
    );
  }
}
Run Code Online (Sandbox Code Playgroud)

javascript reactjs eslint react-jsx

13
推荐指数
2
解决办法
6292
查看次数

标签 统计

eslint ×3

javascript ×3

reactjs ×2

configuration ×1

lint ×1

react-jsx ×1