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

[New] named: add commonjs option #1222

Merged
merged 2 commits into from Aug 5, 2021

Conversation

vikr01
Copy link
Contributor

@vikr01 vikr01 commented Oct 25, 2018

Related: #1145

Adds an option commonjs to named rule, which will check a destructured require statement.

Invalid:

// ./foo.js
export const foo = 'bar';

// ./bar.js
const {baz} = require('./foo');

valid:

// ./bar.js
export const bar = 'foo';
export const foo = 'baz';

// ./baz.js
const {bar} = require('./bar');


// ./foo2.js
const {bar, foo} = require('./bar');

// ./foo3.js
let {bar} = require('./bar'), {foo} = require('./bar');

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 96.948% when pulling b776460 on vikr01:feature/named-require into b4a2f11 on benmosher:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 96.948% when pulling b776460 on vikr01:feature/named-require into b4a2f11 on benmosher:master.

@coveralls
Copy link

coveralls commented Oct 25, 2018

Coverage Status

Coverage decreased (-0.4%) to 96.952% when pulling d13c122 on vikr01:feature/named-require into db471a8 on benmosher:master.

@vikr01 vikr01 force-pushed the feature/named-require branch 2 times, most recently from 8fe7df2 to 2a3153c Compare October 26, 2018 06:01
src/rules/named.js Outdated Show resolved Hide resolved
src/rules/named.js Outdated Show resolved Hide resolved
src/rules/named.js Outdated Show resolved Hide resolved
src/rules/named.js Outdated Show resolved Hide resolved
src/rules/named.js Outdated Show resolved Hide resolved
tests/src/rules/named.js Outdated Show resolved Hide resolved
@ljharb ljharb removed the request for review from benmosher August 5, 2021 05:17
@ljharb ljharb changed the title Check named exports on destructured require [New] named: add commonjs option Aug 5, 2021
@ljharb ljharb merged commit 54d86c8 into import-js:master Aug 5, 2021
@vikr01 vikr01 deleted the feature/named-require branch August 5, 2021 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

3 participants