Giter VIP home page Giter VIP logo

Comments (8)

getify avatar getify commented on May 22, 2024 3

Sorry this took so long to get around to fixing, but should be fixed now, released as v10.0.0. Thanks!

from eslint-plugin-proper-arrows.

getify avatar getify commented on May 22, 2024 1

This plugin itself should not have any different behavior depending on what ESLint env it is run in. The only explanation I can think of is either different configuration being applied in these different envs, or (more likely!) ESLint itself is a different version in these different envs, and therefore it produces a different parse tree for the plugin to inspect.

from eslint-plugin-proper-arrows.

getify avatar getify commented on May 22, 2024 1

So, to restate, is the issue that Babel has changed its representation (in an AST sense) of export const a = .. from version 5 to 6, so that my plugin no longer recognizes those?

from eslint-plugin-proper-arrows.

cirocfc avatar cirocfc commented on May 22, 2024 1

I'm truly grateful Kyle!

from eslint-plugin-proper-arrows.

cirocfc avatar cirocfc commented on May 22, 2024

That's what I thought! I checked the ESLint version on my project, it is using 5.16.0. The ESLint installed version for eslint-plugin-proper-arrows is also using 5.16.0. So far so good.

On the other hand, VSCode and its extensions are all updated, so they are using an ESLint version greater than version 6 according to their Github repo.

When the problem first occurred I thought it was the versions, so I updated my project to use version 6.6.0 (just for testing, cause I cannot change it until a plugin is also updated) and the CLI continued to report errors on "where" rule only using export default () => { }; but not when using export const a = () => { };. The editor did report the first one but not the second one as well. So now the results are the same, but the export const a = () => { }; case is not being notified.

Maybe something changed from version 5 to 6 on ESLint and affected how this plugin notifies the "where" rules?

By using the test case I could get an empty array for the case above, so it would never be caught on this if statement and would not be notified.

from eslint-plugin-proper-arrows.

cirocfc avatar cirocfc commented on May 22, 2024

So, to restate, is the issue that Babel has changed its representation (in an AST sense) of export const a = .. from version 5 to 6, so that my plugin no longer recognizes those?

I think you meant ESLint instead of Babel, right? In this case the answer is yes. What I am lead to believe is that ESLint changed how it reports the code representation.

I made an extremely simple sample of my setup, just so you can be sure I am not messing it up. And if that is the case, please forgive me. This is the repo https://github.com/cirocfc/arrow-lint-example.

Note that I intentionally duplicated my functions inside index.js file so the first part could be reported by your plugin while the second was supposed to work fine.

from eslint-plugin-proper-arrows.

getify avatar getify commented on May 22, 2024

I just upgraded to ESLint 6.8.0, and the test suite fully passes. Am I missing a test case that should be failing on 6.x?

from eslint-plugin-proper-arrows.

cirocfc avatar cirocfc commented on May 22, 2024

Hey Kyle!

Thanks for the updates. I just updated my project with the new version of your plugin and ESLint to v6 and it seems that the version related erros are all gone.

The only case that I noticed is that when a function is declared using an arrow and it is exported. In this case the plugin does not notify if global flag is false. It should be notified by export flag, right?

For instance:

// some_code.js

// global as false: not notified
export const a = () => { console.log('hello!'); };
// export const is not covered, but export default is

// global as false: notified
export default () => { console.log('hello!'); };
// export default is covered, but not export const

// notified with global as true as it is a top level arrow
// but not because of export flag
export const a = () => { };

This is the config that I am testing it on:

// .eslintrc.js
module.exports = {
  root: true,
  env: {
    node: true,
    browser: true,
    es6: true,
    jest: true,
  },
  extends: [
    // I still have to refactor some files in order to enable the full plugin
    // For now I am using just `export` and `property`
    // 'plugin:@getify/proper-arrows/getify-says',
  ],
  parserOptions: {
    parser: 'babel-eslint',
  },
  plugins: [
    '@getify/proper-arrows',
  ],
  rules: {
    '@getify/proper-arrows/where': ['error', {
      'global': false,
      'property': true,
      'export': true,
      'trivial': false
    }]
  },
};

I updated the example code btw

from eslint-plugin-proper-arrows.

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.