Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react/require-extension is deprecated #978

Closed
billyjanitsch opened this issue Aug 1, 2016 · 24 comments
Closed

react/require-extension is deprecated #978

billyjanitsch opened this issue Aug 1, 2016 · 24 comments

Comments

@billyjanitsch
Copy link
Contributor

See the deprecation notice. The newly released eslint-config-airbnb@10.0.0 includes this rule, so a warning is printed to the console.

@ljharb
Copy link
Collaborator

ljharb commented Aug 1, 2016

Sadly the replacement rule can't yet be configured for us - it's blocked by import-js/eslint-plugin-import#390 (as indicated here).

@barbalex
Copy link

this makes working with airbnb in atom completely unusable, see AtomLinter/linter-eslint#579 (comment)

lvarayut added a commit to lvarayut/relay-fullstack that referenced this issue Aug 22, 2016
- While waiting for the airbnb/javascript#978,
  we can't really upgrade to eslint 3.x
@sompylasar
Copy link

@barbalex you might want to vote for the culprit issue that causes Atom to throw the exception: jsx-eslint/eslint-plugin-react#783

@dtothefp
Copy link

dtothefp commented Aug 30, 2016

@barbalex @billyjanitsch you can make your own override config, maybe this is a big hack but seems to work

//airbnd-override.js
import omit from 'lodash/omit';
import merge from 'lodash/merge';
import airbnb from 'eslint-config-airbnb';

const config = airbnb.extends.reduce((acc, fp) => {
  return merge(acc, require(fp));
}, {});
const {rules: allRules} = config;
const rules = omit(allRules, 'react/require-extension');

export default Object.assign({}, config, {rules});

//src/index.js => compiled to dist/index.js
export default {
  parser: 'babel-eslint',
  extends: [
    './airbnd-overwride.js'
  ].map(require.resolve),
  env: {
    'shared-node-browser': true
  },
  ecmaFeatures: {
    experimentalObjectRestSpread: true
  },
  rules: {
    'comma-dangle': 0,
    'arrow-body-style': 0,
    'object-curly-spacing': 0,
    'global-require': 0
  }
};

//.eslintrc
{
  "extends": "./dist/index.js"
}

@ljharb
Copy link
Collaborator

ljharb commented Aug 30, 2016

that's a whole lot of work to avoid a single console.warn

@dtothefp
Copy link

@ljharb truedat

@yangshun
Copy link

yangshun commented Sep 4, 2016

Temporary workaround for my project that is using eslint would be to add the rule to .eslintrc:

{
  "extends": "airbnb",
  "rules": {
    "react/require-extension": "off"
  }
}

@GeekG1rl
Copy link

GeekG1rl commented Sep 8, 2016

@yangshun you absolute hero - that warning message was really annoying me!

@JasonEtco
Copy link

That helps make it usable, but I'm seeing problems with eslint-plugin-import; after settings react/require-extension: off all of my imports are throwing import/no-unresolved errors for every import (both absolute and relative). Any ideas?

@ljharb
Copy link
Collaborator

ljharb commented Sep 9, 2016

Just to test - if you set it explicitly to "error", do all those import warnings go away?

@ljharb
Copy link
Collaborator

ljharb commented Sep 9, 2016

  • If not, it's related to your project's eslint configs, and not to that rule

@JasonEtco
Copy link

@ljharb Do you mean import/no-unresolved or react/require-extension?

@ljharb
Copy link
Collaborator

ljharb commented Sep 9, 2016

The latter :-)

@JasonEtco
Copy link

@ljharb Then I get that spooky error message: AtomLinter/linter-eslint#579

@ljharb
Copy link
Collaborator

ljharb commented Sep 9, 2016

Wait - are you saying you get those linter errors in Atom, or on the command line? The only thing that matters for reporting to anything but $EDITOR is that it happens on the command line - anything happening in $EDITOR only is a specific bug that that project needs to fix.

@yangshun
Copy link

yangshun commented Sep 9, 2016

@JasonEtco are you using webpack resolve root?

@JasonEtco
Copy link

@yangshun No, I'm not. We opted for Gulp to build the app instead. Is there a setting to do that within Atom? (Sorry if this is off-topic)

@sompylasar
Copy link

@JasonEtco The spooky error message is triggered by console.log or console.warn in ESLint plugins, caused by a bug in Atom, it throws on console calls in certain conditions (child_process), see atom/atom#12504

ahutchings added a commit to jurassix/atom-javascript-refactor that referenced this issue Sep 10, 2016
kiki-le-singe added a commit to kiki-le-singe/react-redux-universal-boilerplate that referenced this issue Sep 10, 2016
error: « The react/require-extension rule is deprecated. Please use the
import/extensions rule from eslint-plugin-import instead. »

see:
airbnb/javascript#978 (comment)
@ljharb
Copy link
Collaborator

ljharb commented Sep 20, 2016

This is now waiting on a release of eslint-plugin-import.

@mkscrg
Copy link

mkscrg commented Sep 23, 2016

eslint-plugin-import@1.16.0 has been released.

@ljharb
Copy link
Collaborator

ljharb commented Sep 23, 2016

This will need a major version update, so I'll try to get that out this weekend.

@ljharb ljharb closed this as completed in 0dae56a Sep 25, 2016
@ljharb
Copy link
Collaborator

ljharb commented Sep 25, 2016

v12.0.0 of the config should resolve this issue.

@goodaccoustics
Copy link

This react/require-extension issue was fixed when I downgraded the node module "eslint-plugin-react" so as to get back this check rule.

@ljharb
Copy link
Collaborator

ljharb commented Nov 15, 2018

@goodaccoustics the check exists in a replacement rule; there's no need to downgrade.

Olaf0703 added a commit to Olaf0703/full-stack that referenced this issue Mar 19, 2023
- While waiting for the airbnb/javascript#978,
  we can't really upgrade to eslint 3.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants