eslint-plugin-require-sort
eslint-plugin-require-sort copied to clipboard
Does plugin consider nested object destructuring when analyzing require statements?
Hi, thanks for this plugin!
I've started experimenting a bit with it and I've found out that it seems to ignore require statements that are using nested object destructuring.
Check this example:
const {C: {nestedProperty}} = require('./c.js');
const {A} = require('./a.js');
const {B} = require('./b.js');
const a = new A();
const b = new B();
const c = new nestedProperty();
It doesn't really matter where you put the line with nestedProperty
, ESLint do not throw any errors. Hence I'm wondering if this might be an issue or just the expected behaviour.
I would expect it to complain cause nestedProperty
is using small caps for the first letter, so it should be placed after {B}
.
I'm using default config with 'require-sort/require-sort': 'error'
in my .eslintrc.js
file.
Thanks again.
@WarioNeila86 thanks for feedback!
When I developed this I think I did not implement the check for nested object restructuring. I'll take a look soon (TM).