spences10
spences10

Reputation: 600

ESLint rule being ignored

Just trying to have a SFC and ESLint is complaining

I haz rules in my .eslinrc

{
  "env": {
    "es6": true,
    "browser": true
  },
  "extends": "airbnb",
  "rules": {
    "semi": [2, "never"],
    "no-unexpected-multiline": 2,
    "no-console": 0,
    "react/prefer-stateless-function": [0, {
      "ignorePureComponents": true
    }],
    "comma-dangle": ["error", "never"],
    "arrow-body-style": ["error", "never"]
  }
}

Even added the /* eslint arrow-body-style: ["error", "never"]*/ directly above the error, anyone else come across this?

What am I doing wrong

ESLINT RULE PLZ!!

Upvotes: 0

Views: 387

Answers (1)

Damien Monni
Damien Monni

Reputation: 1548

You can use a disable-next-line just before your export:

// eslint-disable-next-line arrow-body-style
export onst Hi = () > {
 [...]
}

Maybe you could also try to replace "arrow-body-style": ["error", "never"] by "arrow-body-style": "off" in your .eslinrc.

By the way, if you just want to avoid this error, replace your code with the following:

import React from 'react';

export const Hi = () => (
  <div>
    <h1>Hi</h1>
  </div>
);

export default Hi;

Upvotes: 2

Related Questions