Skip to content

Commit

Permalink
README updates for es6-only + resolve.root (#20 and #18)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmosher committed Apr 1, 2015
1 parent 5ba3d8c commit 8a62098
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ This plugin intends to support linting of ES6 import syntax, and prevent issues
* Ensure imports point to a file/module that can be resolved. ([`no-unresolved`](#no-unresolved))
* Ensure named imports correspond to a named export in the remote file. ([`named`](#named))
* Ensure a default export is present, given a default import. ([`default`](#default))
* Report ES6 import of CommonJS modules. ([`no-common`](#no-common))
* Ensure imported namespaces contain dereferenced properties as they are dereferenced. ([`namespace`](#namespace))
* Report assignments (at any scope) to imported names/namespaces. ([`no-reassign`](#no-reassign))

Expand All @@ -21,36 +20,34 @@ This plugin intends to support linting of ES6 import syntax, and prevent issues
Ensures an imported module can be resolved to a module on the local filesystem,
as defined by standard Node `require.resolve` behavior.

### `named`
Will attempt to resolve from one or more paths from the `resolve.root` shared setting, i.e.

Verifies that all named imports are part of the set of named exports in the referenced module.
```
---
settings:
resolve.root: '...'
```
or
```
resolve.root:
- '...'
- '...'
```

Note that if there are _no_ named exports, nor a default export, this rule will
not report a mismatch, to allow Babel-style `import` of CommonJS modules.

Provide the `es6-only` option in your rule config if you would like to enforce this on all imports.
### `named`

Verifies that all named imports are part of the set of named exports in the referenced module.

### `default`

If a default import is requested, this rule will report if there is no default
export in the imported module.

Note that if there are _no_ named exports, nor a default export, this rule will
not report a mismatch, to allow Babel-style `import` of CommonJS modules.

Provide the `es6-only` option in your rule config if you would like to enforce
this on all imports.

### `no-common`

Report for imports that are defined as CommonJS modules, identified by the presence of `module.exports` or `exports[...]` assignments within the module. Off by default.

### `namespace`

Enforces names exist at the time they are dereferenced, when imported as a full namespace (i.e. `import * as foo from './foo'; foo.bar();` will report if `bar` is not exported by `./foo`.).

If remote module is CommonJS, will not attempt to enforce.

Will report at the import declaration if there are _no_ exported names found.

Also, will report for computed references (i.e. `foo["bar"]()`).
Expand Down

0 comments on commit 8a62098

Please sign in to comment.