Comments (8)
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.
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.
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.
I'm truly grateful Kyle!
from eslint-plugin-proper-arrows.
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.
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.
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.
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)
- Create a wizard for picking rules config
- Add "location" rule to forbid use of arrow functions in certain places HOT 1
- Add ternary `? :` to the list forbidden of concise return expressions
- Prevent arrow functions that implicitly return arrow functions HOT 1
- Allowing no name for class property functions? HOT 10
- Elision of destructured function parameters causes crash HOT 1
- add config preset(s) HOT 5
- treat `void ..` expression as "trivial" arrow body
- is @getify/proper-arrows/params needed? HOT 2
- @getify/proper-arrows/names should follow func-names schema HOT 2
- Add `id` to the default allowed list of short params HOT 5
- False positive on object destructuring in arrow function parameters HOT 4
- Errors when disabling the rules in Create React App HOT 4
- Extend definition of trivial to include comparisons HOT 3
- Include delegations under trivial functions HOT 5
- Bug (?): Not identifying module-level arrow functions HOT 4
- `where` rule global option detects passing arrow as callback on module level as violation HOT 3
- Add setting to disallow "arrow function declarations" at the global/top level HOT 18
- Ignoring React components defined as an arrow function HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eslint-plugin-proper-arrows.