Coder Social home page Coder Social logo

Comments (3)

yannickcr avatar yannickcr commented on May 8, 2024

Hi,

There is a typo in the rule name in your configuration and ESLint cannot find this unknown rule.

The rule name should be react/jsx-no-undef:

{
  "rules": {
    "react/jsx-no-undef": 1
  },
  "plugins": [
    "react"
  ],
  "ecmaFeatures": {
    "jsx": true
  }
}

from eslint-plugin-react.

dmnd avatar dmnd commented on May 8, 2024

Thanks for pointing that out 😊

I copypasted those rules names but must have done something crazy in my editor without noticing.

from eslint-plugin-react.

AntouanK avatar AntouanK commented on May 8, 2024

I get the same error, and I'm pretty sure I got the name right :)

for example:
.eslintrc

{
  "env": {
    "browser": true,
    "node": true,
    "es6": true
  },
  "ecmaFeatures": {
    "templateStrings": true,
    "arrowFunctions": true,
    "blockBindings": true,
    "modules": true,
    "forOf": true,
    "jsx": true
  },
  "plugins": [
    "react"
  ],
  "globals": {

  },
  "rules": {
     "react/jsx-no-duplicate-props": 1
   }
}

output ( I print errors inside a gulp task )

[gulp] /client/src/scripts/ROOT_STATE.js ln 2, col 1  warning Definition for rule 'react/jsx-no-duplicate-props' was not found

same messsage for all the files.

I use eslint like this ( although it should be irrelevant ):

const eslint        = require('eslint');

//    get a linter reference
const linter        = eslint.linter;

// read .eslintrc
const eslintrc      = JSON.parse(
  fs.readFileSync( path.resolve(__dirname, '.eslintrc') ).toString()
);

//  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  lint-scripts
gulp.task('lint-scripts', () => {

  return gulp.src([
    `${paths.scripts}/**/*.js`,
    `${paths.scripts}/**/*.jsx`
  ])
  .pipe(
    tap(file => {

      let fileContents = file.contents.toString();
      let messages = linter.verify(fileContents, eslintrc);

      if(messages.length > 0){
        messages
        .map(msg => {
          msg.filePath = file.path;
          return msg;
        })
        .forEach(lintLogger);
      }
    })
  );
});

from eslint-plugin-react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.