init source
This commit is contained in:
+972
@@ -0,0 +1,972 @@
|
||||
# Change Log
|
||||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
This change log adheres to standards from [Keep a CHANGELOG](http://keepachangelog.com).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [2.18.2] - 2019-07-19
|
||||
- Skip warning on type interfaces ([#1425], thanks [@lencioni])
|
||||
|
||||
## [2.18.1] - 2019-07-18
|
||||
|
||||
### Fixed
|
||||
- Improve parse perf when using `@typescript-eslint/parser` ([#1409], thanks [@bradzacher])
|
||||
- [`prefer-default-export`]: don't warn on TypeAlias & TSTypeAliasDeclaration ([#1377], thanks [@sharmilajesupaul])
|
||||
- [`no-unused-modules`]: Exclude package "main"/"bin"/"browser" entry points ([#1404], thanks [@rfermann])
|
||||
- [`export`]: false positive for typescript overloads ([#1412], thanks [@golopot])
|
||||
|
||||
### Refactors
|
||||
- [`no-extraneous-dependencies`], `importType`: remove lodash ([#1419], thanks [@ljharb])
|
||||
|
||||
## [2.18.0] - 2019-06-24
|
||||
|
||||
### Added
|
||||
- Support eslint v6 ([#1393], thanks [@sheepsteak])
|
||||
- [`order`]: Adds support for correctly sorting unknown types into a single group ([#1375], thanks [@swernerx])
|
||||
- [`order`]: add fixer for destructuring commonjs import ([#1372], thanks [@golopot])
|
||||
- typescript config: add TS def extensions + defer to TS over JS ([#1366], thanks [@benmosher])
|
||||
|
||||
### Fixed
|
||||
- [`no-unused-modules`]: handle ClassDeclaration ([#1371], thanks [@golopot])
|
||||
|
||||
### Docs
|
||||
- [`no-cycle`]: split code examples so file separation is obvious ([#1370], thanks [@alex-page])
|
||||
- [`no-named-as-default-member`]: update broken link ([#1389], thanks [@fooloomanzoo])
|
||||
|
||||
## [2.17.3] - 2019-05-23
|
||||
|
||||
### Fixed
|
||||
- [`no-common-js`]: Also throw an error when assigning ([#1354], thanks [@charlessuh])
|
||||
- [`no-unused-modules`]: don't crash when lint file outside src-folder ([#1347], thanks [@rfermann])
|
||||
- [`no-unused-modules`]: make `import { name as otherName }` work ([#1340], [#1342], thanks [@rfermann])
|
||||
- [`no-unused-modules`]: make appveyor tests passing ([#1333], thanks [@rfermann])
|
||||
- [`named`]: ignore Flow `typeof` imports and `type` exports ([#1345], thanks [@loganfsmyth])
|
||||
- [refactor] fix eslint 6 compat by fixing imports (thank [@ljharb])
|
||||
- Improve support for Typescript declare structures ([#1356], thanks [@christophercurrie])
|
||||
|
||||
### Docs
|
||||
- add missing `no-unused-modules` in README ([#1358], thanks [@golopot])
|
||||
- [`no-unused-modules`]: Indicates usage, plugin defaults to no-op, and add description to main README.md ([#1352], thanks [@johndevedu])
|
||||
[@christophercurrie]: https://github.com/christophercurrie
|
||||
- Document `env` option for `eslint-import-resolver-webpack` ([#1363], thanks [@kgregory])
|
||||
|
||||
## [2.17.2] - 2019-04-16
|
||||
|
||||
### Fixed
|
||||
- [`no-unused-modules`]: avoid crash when using `ignoreExports`-option ([#1331], [#1323], thanks [@rfermann])
|
||||
- [`no-unused-modules`]: make sure that rule with no options will not fail ([#1330], [#1334], thanks [@kiwka])
|
||||
|
||||
## [2.17.1] - 2019-04-13
|
||||
|
||||
### Fixed
|
||||
- require v2.4 of `eslint-module-utils` ([#1322])
|
||||
|
||||
## [2.17.0] - 2019-04-13
|
||||
|
||||
### Added
|
||||
- [`no-useless-path-segments`]: Add `noUselessIndex` option ([#1290], thanks [@timkraut])
|
||||
- [`no-duplicates`]: Add autofix ([#1312], thanks [@lydell])
|
||||
- Add [`no-unused-modules`] rule ([#1142], thanks [@rfermann])
|
||||
- support export type named exports from typescript ([#1304], thanks [@bradennapier] and [@schmod])
|
||||
|
||||
### Fixed
|
||||
- [`order`]: Fix interpreting some external modules being interpreted as internal modules ([#793], [#794] thanks [@ephys])
|
||||
- allow aliases that start with @ to be "internal" ([#1293], [#1294], thanks [@jeffshaver])
|
||||
- aliased internal modules that look like core modules ([#1297], thanks [@echenley])
|
||||
- [`namespace`]: add check for null ExportMap ([#1235], [#1144], thanks [@ljqx])
|
||||
- [ExportMap] fix condition for checking if block comment ([#1234], [#1233], thanks [@ljqx])
|
||||
- Fix overwriting of dynamic import() CallExpression ([`no-cycle`], [`no-relative-parent-import`], [`no-unresolved`], [`no-useless-path-segments`]) ([#1218], [#1166], [#1035], thanks [@vikr01])
|
||||
- [`export`]: false positives for typescript type + value export ([#1319], thanks [@bradzacher])
|
||||
- [`export`]: Support typescript namespaces ([#1320], [#1300], thanks [@bradzacher])
|
||||
|
||||
### Docs
|
||||
- Update readme for Typescript ([#1256], [#1277], thanks [@kirill-konshin])
|
||||
- make rule names consistent ([#1112], thanks [@feychenie])
|
||||
|
||||
### Tests
|
||||
- fix broken tests on master ([#1295], thanks [@jeffshaver] and [@ljharb])
|
||||
- [`no-commonjs`]: add tests that show corner cases ([#1308], thanks [@TakeScoop])
|
||||
|
||||
|
||||
## [2.16.0] - 2019-01-29
|
||||
### Added
|
||||
- `typescript` config ([#1257], thanks [@kirill-konshin])
|
||||
|
||||
### Fixed
|
||||
- Memory leak of `SourceCode` objects for all parsed dependencies, resolved. (issue [#1266], thanks [@asapach] and [@sergei-startsev] for digging in)
|
||||
|
||||
## [2.15.0] - 2019-01-22
|
||||
### Added
|
||||
- new rule: [`no-named-export`] ([#1157], thanks [@fsmaia])
|
||||
|
||||
### Fixed
|
||||
- [`no-extraneous-dependencies`]: `packageDir` option with array value was clobbering package deps instead of merging them ([#1175]/[#1176], thanks [@aravindet] & [@pzhine])
|
||||
- [`dynamic-import-chunkname`]: Add proper webpack comment parsing ([#1163], thanks [@st-sloth])
|
||||
- [`named`]: fix destructuring assignment ([#1232], thanks [@ljqx])
|
||||
|
||||
|
||||
## [2.14.0] - 2018-08-13
|
||||
* 69e0187 (HEAD -> master, source/master, origin/master, origin/HEAD) Merge pull request #1151 from jf248/jsx
|
||||
|\
|
||||
| * e30a757 (source/pr/1151, fork/jsx) Add JSX check to namespace rule
|
||||
|/
|
||||
* 8252344 (source/pr/1148) Add error to output when module loaded as resolver has invalid API
|
||||
### Added
|
||||
- [`no-useless-path-segments`]: add commonJS (CJS) support ([#1128], thanks [@1pete])
|
||||
- [`namespace`]: add JSX check ([#1151], thanks [@jf248])
|
||||
|
||||
### Fixed
|
||||
- [`no-cycle`]: ignore Flow imports ([#1126], thanks [@gajus])
|
||||
- fix Flow type imports ([#1106], thanks [@syymza])
|
||||
- [`no-relative-parent-imports`]: resolve paths ([#1135], thanks [@chrislloyd])
|
||||
- [`import/order`]: fix autofixer when using typescript-eslint-parser ([#1137], thanks [@justinanastos])
|
||||
- repeat fix from [#797] for [#717], in another place (thanks [@ljharb])
|
||||
|
||||
### Refactors
|
||||
- add explicit support for RestElement alongside ExperimentalRestProperty (thanks [@ljharb])
|
||||
|
||||
## [2.13.0] - 2018-06-24
|
||||
### Added
|
||||
- Add ESLint 5 support ([#1122], thanks [@ai] and [@ljharb])
|
||||
- Add [`no-relative-parent-imports`] rule: disallow relative imports from parent directories ([#1093], thanks [@chrislloyd])
|
||||
|
||||
### Fixed
|
||||
- `namespace` rule: ensure it works in eslint 5/ecmaVersion 2018 (thanks [@ljharb])
|
||||
|
||||
## [2.12.0] - 2018-05-17
|
||||
### Added
|
||||
- Ignore type imports for [`named`] rule ([#931], thanks [@mattijsbliek])
|
||||
- Add documentation for [`no-useless-path-segments`] rule ([#1068], thanks [@manovotny])
|
||||
- `packageDir` option for [`no-extraneous-dependencies`] can be array-valued ([#1085], thanks [@hulkish])
|
||||
|
||||
## [2.11.0] - 2018-04-09
|
||||
### Added
|
||||
- Fixer for [`first`] ([#1046], thanks [@fengkfengk])
|
||||
- `allow-require` option for [`no-commonjs`] rule ([#880], thanks [@futpib])
|
||||
|
||||
### Fixed
|
||||
- memory/CPU regression where ASTs were held in memory ([#1058], thanks [@klimashkin]/[@lukeapage])
|
||||
|
||||
## [2.10.0] - 2018-03-29
|
||||
### Added
|
||||
- Autofixer for [`order`] rule ([#908], thanks [@tihonove])
|
||||
- Add [`no-cycle`] rule: reports import cycles.
|
||||
|
||||
## [2.9.0] - 2018-02-21
|
||||
### Added
|
||||
- Add [`group-exports`] rule: style-guide rule to report use of multiple named exports ([#721], thanks [@robertrossmann])
|
||||
- Add [`no-self-import`] rule: forbids a module from importing itself. ([#727], [#449], [#447], thanks [@giodamelio]).
|
||||
- Add [`no-default-export`] rule ([#889], thanks [@isiahmeadows])
|
||||
- Add [`no-useless-path-segments`] rule ([#912], thanks [@graingert] and [@danny-andrews])
|
||||
- ... and more! check the commits for v[2.9.0]
|
||||
|
||||
## [2.8.0] - 2017-10-18
|
||||
### Added
|
||||
- [`exports-last`] rule ([#620] + [#632], thanks [@k15a])
|
||||
|
||||
### Changed
|
||||
- Case-sensitivity checking ignores working directory and ancestors. ([#720] + [#858], thanks [@laysent])
|
||||
|
||||
### Fixed
|
||||
- support scoped modules containing hyphens ([#744], thanks [@rosswarren])
|
||||
- core-modules now resolves files inside declared modules ([#886] / [#891], thanks [@mplewis])
|
||||
- TypeError for missing AST fields from TypeScript ([#842] / [#944], thanks [@alexgorbatchev])
|
||||
|
||||
## [2.7.0] - 2017-07-06
|
||||
### Changed
|
||||
- [`no-absolute-path`] picks up speed boost, optional AMD support ([#843], thanks [@jseminck])
|
||||
|
||||
## [2.6.1] - 2017-06-29
|
||||
### Fixed
|
||||
- update bundled node resolver dependency to latest version
|
||||
|
||||
## [2.6.0] - 2017-06-23
|
||||
### Changed
|
||||
- update tests / peerDeps for ESLint 4.0 compatibility ([#871], thanks [@mastilver])
|
||||
- [`memo-parser`] updated to require `filePath` on parser options as it melts
|
||||
down if it's not there, now that this plugin always provides it. (see [#863])
|
||||
|
||||
## [2.5.0] - 2017-06-22
|
||||
|
||||
Re-releasing v[2.4.0] after discovering that the memory leak is isolated to the [`memo-parser`],
|
||||
which is more or less experimental anyway.
|
||||
|
||||
### Added
|
||||
- Autofixer for newline-after-import. ([#686] + [#696], thanks [@eelyafi])
|
||||
|
||||
## [2.4.0] - 2017-06-02 [YANKED]
|
||||
|
||||
Yanked due to critical issue in eslint-module-utils with cache key resulting from [#839].
|
||||
|
||||
### Added
|
||||
- Add `filePath` into `parserOptions` passed to `parser` ([#839], thanks [@sompylasar])
|
||||
- Add `allow` option to [`no-unassigned-import`] to allow for files that match the globs ([#671], [#737], thanks [@kevin940726]).
|
||||
|
||||
## [2.3.0] - 2017-05-18
|
||||
### Added
|
||||
- [`no-anonymous-default-export`] rule: report anonymous default exports ([#712], thanks [@duncanbeevers]).
|
||||
- Add new value to [`order`]'s `newlines-between` option to allow newlines inside import groups ([#627], [#628], thanks [@giodamelio])
|
||||
- Add `count` option to the [`newline-after-import`] rule to allow configuration of number of newlines expected ([#742], thanks [@ntdb])
|
||||
|
||||
### Changed
|
||||
- [`no-extraneous-dependencies`]: use `read-pkg-up` to simplify finding + loading `package.json` ([#680], thanks [@wtgtybhertgeghgtwtg])
|
||||
- Add support to specify the package.json [`no-extraneous-dependencies`] ([#685], thanks [@ramasilveyra])
|
||||
|
||||
### Fixed
|
||||
- attempt to fix crash in [`no-mutable-exports`]. ([#660])
|
||||
- "default is a reserved keyword" in no-maned-default tests by locking down babylon to 6.15.0 (#756, thanks @gmathieu)
|
||||
- support scoped modules containing non word characters
|
||||
|
||||
|
||||
## [2.2.0] - 2016-11-07
|
||||
### Fixed
|
||||
- Corrected a few gaffs in the auto-ignore logic to fix major performance issues
|
||||
with projects that did not explicitly ignore `node_modules`. ([#654])
|
||||
- [`import/ignore` setting] was only being respected if the ignored module didn't start with
|
||||
an `import` or `export` JS statement
|
||||
- [`prefer-default-export`]: fixed crash on export extensions ([#653])
|
||||
|
||||
## [2.1.0] - 2016-11-02
|
||||
### Added
|
||||
- Add [`no-named-default`] rule: style-guide rule to report use of unnecessarily named default imports ([#596], thanks [@ntdb])
|
||||
- [`no-extraneous-dependencies`]: check globs against CWD + absolute path ([#602] + [#630], thanks [@ljharb])
|
||||
|
||||
### Fixed
|
||||
- [`prefer-default-export`] handles flow `export type` ([#484] + [#639], thanks [@jakubsta])
|
||||
- [`prefer-default-export`] handles re-exported default exports ([#609])
|
||||
- Fix crash when using [`newline-after-import`] with decorators ([#592])
|
||||
- Properly report [`newline-after-import`] when next line is a decorator
|
||||
- Fixed documentation for the default values for the [`order`] rule ([#601])
|
||||
|
||||
## [2.0.1] - 2016-10-06
|
||||
### Fixed
|
||||
- Fixed code that relied on removed dependencies. ([#604])
|
||||
|
||||
## [2.0.0]! - 2016-09-30
|
||||
### Added
|
||||
- [`unambiguous`] rule: report modules that are not unambiguously ES modules.
|
||||
- `recommended` shared config. Roughly `errors` and `warnings` mixed together,
|
||||
with some `parserOptions` in the mix. ([#402])
|
||||
- `react` shared config: added `jsx: true` to `parserOptions.ecmaFeatures`.
|
||||
- Added [`no-webpack-loader-syntax`] rule: forbid custom Webpack loader syntax in imports. ([#586], thanks [@fson]!)
|
||||
- Add option `newlines-between: "ignore"` to [`order`] ([#519])
|
||||
- Added [`no-unassigned-import`] rule ([#529])
|
||||
|
||||
### Breaking
|
||||
- [`import/extensions` setting] defaults to `['.js']`. ([#306])
|
||||
- [`import/ignore` setting] defaults to nothing, and ambiguous modules are ignored natively. This means importing from CommonJS modules will no longer be reported by [`default`], [`named`], or [`namespace`], regardless of `import/ignore`. ([#270])
|
||||
- [`newline-after-import`]: Removed need for an empty line after an inline `require` call ([#570])
|
||||
- [`order`]: Default value for `newlines-between` option is now `ignore` ([#519])
|
||||
|
||||
### Changed
|
||||
- `imports-first` is renamed to [`first`]. `imports-first` alias will continue to
|
||||
exist, but may be removed in a future major release.
|
||||
- Case-sensitivity: now specifically (and optionally) reported by [`no-unresolved`].
|
||||
Other rules will ignore case-mismatches on paths on case-insensitive filesystems. ([#311])
|
||||
|
||||
### Fixed
|
||||
- [`no-internal-modules`]: support `@`-scoped packages ([#577]+[#578], thanks [@spalger])
|
||||
|
||||
## [1.16.0] - 2016-09-22
|
||||
### Added
|
||||
- Added [`no-dynamic-require`] rule: forbid `require()` calls with expressions. ([#567], [#568])
|
||||
- Added [`no-internal-modules`] rule: restrict deep package imports to specific folders. ([#485], thanks [@spalger]!)
|
||||
- [`extensions`]: allow override of a chosen default with options object ([#555], thanks [@ljharb]!)
|
||||
|
||||
### Fixed
|
||||
- [`no-named-as-default`] no longer false-positives on `export default from '...'` ([#566], thanks [@preco21])
|
||||
- [`default`]: allow re-export of values from ignored files as default ([#545], thanks [@skyrpex])
|
||||
|
||||
## [1.15.0] - 2016-09-12
|
||||
### Added
|
||||
- Added an `allow` option to [`no-nodejs-modules`] to allow exceptions ([#452], [#509]).
|
||||
- Added [`no-absolute-path`] rule ([#530], [#538])
|
||||
- [`max-dependencies`] for specifying the maximum number of dependencies (both `import` and `require`) a module can have. (see [#489], thanks [@tizmagik])
|
||||
- Added glob option to config for [`no-extraneous-dependencies`], after much bikeshedding. Thanks, [@knpwrs]! ([#527])
|
||||
|
||||
### Fixed
|
||||
- [`no-named-as-default-member`] Allow default import to have a property named "default" ([#507], [#508], thanks [@jquense] for both!)
|
||||
|
||||
## [1.14.0] - 2016-08-22
|
||||
### Added
|
||||
- [`import/parsers` setting]: parse some dependencies (i.e. TypeScript!) with a different parser than the ESLint-configured parser. ([#503])
|
||||
|
||||
### Fixed
|
||||
- [`namespace`] exception for get property from `namespace` import, which are re-export from commonjs module ([#499] fixes [#416], thanks [@wKich])
|
||||
|
||||
## [1.13.0] - 2016-08-11
|
||||
### Added
|
||||
- `allowComputed` option for [`namespace`] rule. If set to `true`, won't report
|
||||
computed member references to namespaces. (see [#456])
|
||||
|
||||
### Changed
|
||||
- Modified [`no-nodejs-modules`] error message to include the module's name ([#453], [#461])
|
||||
|
||||
### Fixed
|
||||
- [`import/extensions` setting] is respected in spite of the appearance of imports
|
||||
in an imported file. (fixes [#478], thanks [@rhys-vdw])
|
||||
|
||||
## [1.12.0] - 2016-07-26
|
||||
### Added
|
||||
- [`import/external-module-folders` setting]: a possibility to configure folders for "external" modules ([#444], thanks [@zloirock])
|
||||
|
||||
## [1.11.1] - 2016-07-20
|
||||
### Fixed
|
||||
- [`newline-after-import`] exception for `switch` branches with `require`s iff parsed as `sourceType:'module'`.
|
||||
(still [#441], thanks again [@ljharb])
|
||||
|
||||
## [1.11.0] - 2016-07-17
|
||||
### Added
|
||||
- Added an `peerDependencies` option to [`no-extraneous-dependencies`] to allow/forbid peer dependencies ([#423], [#428], thanks [@jfmengels]!).
|
||||
|
||||
### Fixed
|
||||
- [`newline-after-import`] exception for multiple `require`s in an arrow
|
||||
function expression (e.g. `() => require('a') || require('b')`). ([#441], thanks [@ljharb])
|
||||
|
||||
## [1.10.3] - 2016-07-08
|
||||
### Fixed
|
||||
- removing `Symbol` dependencies (i.e. `for-of` loops) due to Node 0.10 polyfill
|
||||
issue (see [#415]). Should not make any discernible semantic difference.
|
||||
|
||||
## [1.10.2] - 2016-07-04
|
||||
### Fixed
|
||||
- Something horrible happened during `npm prepublish` of 1.10.1.
|
||||
Several `rm -rf node_modules && npm i` and `gulp clean && npm prepublish`s later, it is rebuilt and republished as 1.10.2. Thanks [@rhettlivingston] for noticing and reporting!
|
||||
|
||||
## [1.10.1] - 2016-07-02 [YANKED]
|
||||
### Added
|
||||
- Officially support ESLint 3.x. (peerDependencies updated to `2.x - 3.x`)
|
||||
|
||||
## [1.10.0] - 2016-06-30
|
||||
### Added
|
||||
- Added new rule [`no-restricted-paths`]. ([#155]/[#371], thanks [@lo1tuma])
|
||||
- [`import/core-modules` setting]: allow configuration of additional module names,
|
||||
to be treated as builtin modules (a la `path`, etc. in Node). ([#275] + [#365], thanks [@sindresorhus] for driving)
|
||||
- React Native shared config (based on comment from [#283])
|
||||
|
||||
### Fixed
|
||||
- Fixed crash with `newline-after-import` related to the use of switch cases. (fixes [#386], thanks [@ljharb] for reporting) ([#395])
|
||||
|
||||
## [1.9.2] - 2016-06-21
|
||||
### Fixed
|
||||
- Issues with ignored/CJS files in [`export`] and [`no-deprecated`] rules. ([#348], [#370])
|
||||
|
||||
## [1.9.1] - 2016-06-16
|
||||
### Fixed
|
||||
- Reordered precedence for loading resolvers. ([#373])
|
||||
|
||||
## [1.9.0] - 2016-06-10
|
||||
### Added
|
||||
- Added support TomDoc comments to [`no-deprecated`]. ([#321], thanks [@josh])
|
||||
- Added support for loading custom resolvers ([#314], thanks [@le0nik])
|
||||
|
||||
### Fixed
|
||||
- [`prefer-default-export`] handles `export function` and `export const` in same file ([#359], thanks [@scottnonnenberg])
|
||||
|
||||
## [1.8.1] - 2016-05-23
|
||||
### Fixed
|
||||
- `export * from 'foo'` now properly ignores a `default` export from `foo`, if any. ([#328]/[#332], thanks [@jkimbo])
|
||||
This impacts all static analysis of imported names. ([`default`], [`named`], [`namespace`], [`export`])
|
||||
- Make [`order`]'s `newline-between` option handle multiline import statements ([#313], thanks [@singles])
|
||||
- Make [`order`]'s `newline-between` option handle not assigned import statements ([#313], thanks [@singles])
|
||||
- Make [`order`]'s `newline-between` option ignore `require` statements inside object literals ([#313], thanks [@singles])
|
||||
- [`prefer-default-export`] properly handles deep destructuring, `export * from ...`, and files with no exports. ([#342]+[#343], thanks [@scottnonnenberg])
|
||||
|
||||
## [1.8.0] - 2016-05-11
|
||||
### Added
|
||||
- [`prefer-default-export`], new rule. ([#308], thanks [@gavriguy])
|
||||
|
||||
### Fixed
|
||||
- Ignore namespace / ES7 re-exports in [`no-mutable-exports`]. ([#317], fixed by [#322]. thanks [@borisyankov] + [@jfmengels])
|
||||
- Make [`no-extraneous-dependencies`] handle scoped packages ([#316], thanks [@jfmengels])
|
||||
|
||||
## [1.7.0] - 2016-05-06
|
||||
### Added
|
||||
- [`newline-after-import`], new rule. ([#245], thanks [@singles])
|
||||
- Added an `optionalDependencies` option to [`no-extraneous-dependencies`] to allow/forbid optional dependencies ([#266], thanks [@jfmengels]).
|
||||
- Added `newlines-between` option to [`order`] rule ([#298], thanks [@singles])
|
||||
- add [`no-mutable-exports`] rule ([#290], thanks [@josh])
|
||||
- [`import/extensions` setting]: a list of file extensions to parse as modules
|
||||
and search for `export`s. If unspecified, all extensions are considered valid (for now).
|
||||
In v2, this will likely default to `['.js', MODULE_EXT]`. ([#297], to fix [#267])
|
||||
|
||||
### Fixed
|
||||
- [`extensions`]: fallback to source path for extension enforcement if imported
|
||||
module is not resolved. Also, never report for builtins (i.e. `path`). ([#296])
|
||||
|
||||
## [1.6.1] - 2016-04-28
|
||||
### Fixed
|
||||
- [`no-named-as-default-member`]: don't crash on rest props. ([#281], thanks [@SimenB])
|
||||
- support for Node 6: don't pass `null` to `path` functions.
|
||||
Thanks to [@strawbrary] for bringing this up ([#272]) and adding OSX support to the Travis
|
||||
config ([#288]).
|
||||
|
||||
## [1.6.0] - 2016-04-25
|
||||
### Added
|
||||
- add [`no-named-as-default-member`] to `warnings` canned config
|
||||
- add [`no-extraneous-dependencies`] rule ([#241], thanks [@jfmengels])
|
||||
- add [`extensions`] rule ([#250], thanks [@lo1tuma])
|
||||
- add [`no-nodejs-modules`] rule ([#261], thanks [@jfmengels])
|
||||
- add [`order`] rule ([#247], thanks [@jfmengels])
|
||||
- consider `resolve.fallback` config option in the webpack resolver ([#254])
|
||||
|
||||
### Changed
|
||||
- [`imports-first`] now allows directives (i.e. `'use strict'`) strictly before
|
||||
any imports ([#256], thanks [@lemonmade])
|
||||
|
||||
### Fixed
|
||||
- [`named`] now properly ignores the source module if a name is re-exported from
|
||||
an ignored file (i.e. `node_modules`). Also improved the reported error. (thanks to [@jimbolla] for reporting)
|
||||
- [`no-named-as-default-member`] had a crash on destructuring in loops (thanks for heads up from [@lemonmade])
|
||||
|
||||
## [1.5.0] - 2016-04-18
|
||||
### Added
|
||||
- report resolver errors at the top of the linted file
|
||||
- add [`no-namespace`] rule ([#239], thanks [@singles])
|
||||
- add [`no-named-as-default-member`] rule ([#243], thanks [@dmnd])
|
||||
|
||||
### Changed
|
||||
- Rearranged rule groups in README in preparation for more style guide rules
|
||||
|
||||
### Removed
|
||||
- support for Node 0.10, via `es6-*` ponyfills. Using native Map/Set/Symbol.
|
||||
|
||||
## [1.4.0] - 2016-03-25
|
||||
### Added
|
||||
- Resolver plugin interface v2: more explicit response format that more clearly covers the found-but-core-module case, where there is no path.
|
||||
Still backwards-compatible with the original version of the resolver spec.
|
||||
- [Resolver documentation](./resolvers/README.md)
|
||||
|
||||
### Changed
|
||||
- using `package.json/files` instead of `.npmignore` for package file inclusion ([#228], thanks [@mathieudutour])
|
||||
- using `es6-*` ponyfills instead of `babel-runtime`
|
||||
|
||||
## [1.3.0] - 2016-03-20
|
||||
Major perf improvements. Between parsing only once and ignoring gigantic, non-module `node_modules`,
|
||||
there is very little added time.
|
||||
|
||||
My test project takes 17s to lint completely, down from 55s, when using the
|
||||
memoizing parser, and takes only 27s with naked `babel-eslint` (thus, reparsing local modules).
|
||||
|
||||
### Added
|
||||
- This change log ([#216])
|
||||
- Experimental memoizing [parser](./memo-parser/README.md)
|
||||
|
||||
### Fixed
|
||||
- Huge reduction in execution time by _only_ ignoring [`import/ignore` setting] if
|
||||
something that looks like an `export` is detected in the module content.
|
||||
|
||||
## [1.2.0] - 2016-03-19
|
||||
Thanks [@lencioni] for identifying a huge amount of rework in resolve and kicking
|
||||
off a bunch of memoization.
|
||||
|
||||
I'm seeing 62% improvement over my normal test codebase when executing only
|
||||
[`no-unresolved`] in isolation, and ~35% total reduction in lint time.
|
||||
|
||||
### Changed
|
||||
- added caching to core/resolve via [#214], configured via [`import/cache` setting]
|
||||
|
||||
## [1.1.0] - 2016-03-15
|
||||
### Added
|
||||
- Added an [`ignore`](./docs/rules/no-unresolved.md#ignore) option to [`no-unresolved`] for those pesky files that no
|
||||
resolver can find. (still prefer enhancing the Webpack and Node resolvers to
|
||||
using it, though). See [#89] for details.
|
||||
|
||||
## [1.0.4] - 2016-03-11
|
||||
### Changed
|
||||
- respect hoisting for deep namespaces ([`namespace`]/[`no-deprecated`]) ([#211])
|
||||
|
||||
### Fixed
|
||||
- don't crash on self references ([#210])
|
||||
- correct cache behavior in `eslint_d` for deep namespaces ([#200])
|
||||
|
||||
## [1.0.3] - 2016-02-26
|
||||
### Changed
|
||||
- no-deprecated follows deep namespaces ([#191])
|
||||
|
||||
### Fixed
|
||||
- [`namespace`] no longer flags modules with only a default export as having no
|
||||
names. (ns.default is valid ES6)
|
||||
|
||||
## [1.0.2] - 2016-02-26
|
||||
### Fixed
|
||||
- don't parse imports with no specifiers ([#192])
|
||||
|
||||
## [1.0.1] - 2016-02-25
|
||||
### Fixed
|
||||
- export `stage-0` shared config
|
||||
- documented [`no-deprecated`]
|
||||
- deep namespaces are traversed regardless of how they get imported ([#189])
|
||||
|
||||
## [1.0.0] - 2016-02-24
|
||||
### Added
|
||||
- [`no-deprecated`]: WIP rule to let you know at lint time if you're using
|
||||
deprecated functions, constants, classes, or modules.
|
||||
|
||||
### Changed
|
||||
- [`namespace`]: support deep namespaces ([#119] via [#157])
|
||||
|
||||
## [1.0.0-beta.0] - 2016-02-13
|
||||
### Changed
|
||||
- support for (only) ESLint 2.x
|
||||
- no longer needs/refers to `import/parser` or `import/parse-options`. Instead,
|
||||
ESLint provides the configured parser + options to the rules, and they use that
|
||||
to parse dependencies.
|
||||
|
||||
### Removed
|
||||
- `babylon` as default import parser (see Breaking)
|
||||
|
||||
## [0.13.0] - 2016-02-08
|
||||
### Added
|
||||
- [`no-commonjs`] rule
|
||||
- [`no-amd`] rule
|
||||
|
||||
### Removed
|
||||
- Removed vestigial `no-require` rule. [`no-commonjs`] is more complete.
|
||||
|
||||
## [0.12.2] - 2016-02-06 [YANKED]
|
||||
Unpublished from npm and re-released as 0.13.0. See [#170].
|
||||
|
||||
## [0.12.1] - 2015-12-17
|
||||
### Changed
|
||||
- Broke docs for rules out into individual files.
|
||||
|
||||
## [0.12.0] - 2015-12-14
|
||||
### Changed
|
||||
- Ignore [`import/ignore` setting] if exports are actually found in the parsed module. Does
|
||||
this to support use of `jsnext:main` in `node_modules` without the pain of
|
||||
managing an allow list or a nuanced deny list.
|
||||
|
||||
## [0.11.0] - 2015-11-27
|
||||
### Added
|
||||
- Resolver plugins. Now the linter can read Webpack config, properly follow
|
||||
aliases and ignore externals, dismisses inline loaders, etc. etc.!
|
||||
|
||||
## Earlier releases (0.10.1 and younger)
|
||||
See [GitHub release notes](https://github.com/benmosher/eslint-plugin-import/releases?after=v0.11.0)
|
||||
for info on changes for earlier releases.
|
||||
|
||||
|
||||
[`import/cache` setting]: ./README.md#importcache
|
||||
[`import/ignore` setting]: ./README.md#importignore
|
||||
[`import/extensions` setting]: ./README.md#importextensions
|
||||
[`import/parsers` setting]: ./README.md#importparsers
|
||||
[`import/core-modules` setting]: ./README.md#importcore-modules
|
||||
[`import/external-module-folders` setting]: ./README.md#importexternal-module-folders
|
||||
|
||||
[`default`]: ./docs/rules/default.md
|
||||
[`dynamic-import-chunkname`]: ./docs/rules/dynamic-import-chunkname.md
|
||||
[`export`]: ./docs/rules/export.md
|
||||
[`exports-last`]: ./docs/rules/exports-last.md
|
||||
[`extensions`]: ./docs/rules/extensions.md
|
||||
[`first`]: ./docs/rules/first.md
|
||||
[`group-exports`]: ./docs/rules/group-exports.md
|
||||
[`imports-first`]: ./docs/rules/first.md
|
||||
[`max-dependencies`]: ./docs/rules/max-dependencies.md
|
||||
[`named`]: ./docs/rules/named.md
|
||||
[`namespace`]: ./docs/rules/namespace.md
|
||||
[`newline-after-import`]: ./docs/rules/newline-after-import.md
|
||||
[`no-absolute-path`]: ./docs/rules/no-absolute-path.md
|
||||
[`no-amd`]: ./docs/rules/no-amd.md
|
||||
[`no-anonymous-default-export`]: ./docs/rules/no-anonymous-default-export.md
|
||||
[`no-commonjs`]: ./docs/rules/no-commonjs.md
|
||||
[`no-cycle`]: ./docs/rules/no-cycle.md
|
||||
[`no-default-export`]: ./docs/rules/no-default-export.md
|
||||
[`no-deprecated`]: ./docs/rules/no-deprecated.md
|
||||
[`no-duplicates`]: ./docs/rules/no-duplicates.md
|
||||
[`no-dynamic-require`]: ./docs/rules/no-dynamic-require.md
|
||||
[`no-extraneous-dependencies`]: ./docs/rules/no-extraneous-dependencies.md
|
||||
[`no-internal-modules`]: ./docs/rules/no-internal-modules.md
|
||||
[`no-mutable-exports`]: ./docs/rules/no-mutable-exports.md
|
||||
[`no-named-as-default-member`]: ./docs/rules/no-named-as-default-member.md
|
||||
[`no-named-as-default`]: ./docs/rules/no-named-as-default.md
|
||||
[`no-named-default`]: ./docs/rules/no-named-default.md
|
||||
[`no-named-export`]: ./docs/rules/no-named-export.md
|
||||
[`no-namespace`]: ./docs/rules/no-namespace.md
|
||||
[`no-nodejs-modules`]: ./docs/rules/no-nodejs-modules.md
|
||||
[`no-restricted-paths`]: ./docs/rules/no-restricted-paths.md
|
||||
[`no-self-import`]: ./docs/rules/no-self-import.md
|
||||
[`no-unassigned-import`]: ./docs/rules/no-unassigned-import.md
|
||||
[`no-unresolved`]: ./docs/rules/no-unresolved.md
|
||||
[`no-unused-modules`]: ./docs/rules/no-unused-modules.md
|
||||
[`no-useless-path-segments`]: ./docs/rules/no-useless-path-segments.md
|
||||
[`no-webpack-loader-syntax`]: ./docs/rules/no-webpack-loader-syntax.md
|
||||
[`order`]: ./docs/rules/order.md
|
||||
[`prefer-default-export`]: ./docs/rules/prefer-default-export.md
|
||||
[`unambiguous`]: ./docs/rules/unambiguous.md
|
||||
|
||||
[`memo-parser`]: ./memo-parser/README.md
|
||||
|
||||
[#1425]: https://github.com/benmosher/eslint-plugin-import/pull/1425
|
||||
[#1419]: https://github.com/benmosher/eslint-plugin-import/pull/1419
|
||||
[#1412]: https://github.com/benmosher/eslint-plugin-import/pull/1412
|
||||
[#1409]: https://github.com/benmosher/eslint-plugin-import/pull/1409
|
||||
[#1404]: https://github.com/benmosher/eslint-plugin-import/pull/1404
|
||||
[#1393]: https://github.com/benmosher/eslint-plugin-import/pull/1393
|
||||
[#1389]: https://github.com/benmosher/eslint-plugin-import/pull/1389
|
||||
[#1377]: https://github.com/benmosher/eslint-plugin-import/pull/1377
|
||||
[#1375]: https://github.com/benmosher/eslint-plugin-import/pull/1375
|
||||
[#1372]: https://github.com/benmosher/eslint-plugin-import/pull/1372
|
||||
[#1371]: https://github.com/benmosher/eslint-plugin-import/pull/1371
|
||||
[#1370]: https://github.com/benmosher/eslint-plugin-import/pull/1370
|
||||
[#1363]: https://github.com/benmosher/eslint-plugin-import/pull/1363
|
||||
[#1358]: https://github.com/benmosher/eslint-plugin-import/pull/1358
|
||||
[#1356]: https://github.com/benmosher/eslint-plugin-import/pull/1356
|
||||
[#1354]: https://github.com/benmosher/eslint-plugin-import/pull/1354
|
||||
[#1352]: https://github.com/benmosher/eslint-plugin-import/pull/1352
|
||||
[#1347]: https://github.com/benmosher/eslint-plugin-import/pull/1347
|
||||
[#1345]: https://github.com/benmosher/eslint-plugin-import/pull/1345
|
||||
[#1342]: https://github.com/benmosher/eslint-plugin-import/pull/1342
|
||||
[#1340]: https://github.com/benmosher/eslint-plugin-import/pull/1340
|
||||
[#1333]: https://github.com/benmosher/eslint-plugin-import/pull/1333
|
||||
[#1331]: https://github.com/benmosher/eslint-plugin-import/pull/1331
|
||||
[#1330]: https://github.com/benmosher/eslint-plugin-import/pull/1330
|
||||
[#1320]: https://github.com/benmosher/eslint-plugin-import/pull/1320
|
||||
[#1319]: https://github.com/benmosher/eslint-plugin-import/pull/1319
|
||||
[#1312]: https://github.com/benmosher/eslint-plugin-import/pull/1312
|
||||
[#1308]: https://github.com/benmosher/eslint-plugin-import/pull/1308
|
||||
[#1304]: https://github.com/benmosher/eslint-plugin-import/pull/1304
|
||||
[#1297]: https://github.com/benmosher/eslint-plugin-import/pull/1297
|
||||
[#1295]: https://github.com/benmosher/eslint-plugin-import/pull/1295
|
||||
[#1294]: https://github.com/benmosher/eslint-plugin-import/pull/1294
|
||||
[#1290]: https://github.com/benmosher/eslint-plugin-import/pull/1290
|
||||
[#1277]: https://github.com/benmosher/eslint-plugin-import/pull/1277
|
||||
[#1257]: https://github.com/benmosher/eslint-plugin-import/pull/1257
|
||||
[#1235]: https://github.com/benmosher/eslint-plugin-import/pull/1235
|
||||
[#1234]: https://github.com/benmosher/eslint-plugin-import/pull/1234
|
||||
[#1232]: https://github.com/benmosher/eslint-plugin-import/pull/1232
|
||||
[#1218]: https://github.com/benmosher/eslint-plugin-import/pull/1218
|
||||
[#1176]: https://github.com/benmosher/eslint-plugin-import/pull/1176
|
||||
[#1163]: https://github.com/benmosher/eslint-plugin-import/pull/1163
|
||||
[#1157]: https://github.com/benmosher/eslint-plugin-import/pull/1157
|
||||
[#1151]: https://github.com/benmosher/eslint-plugin-import/pull/1151
|
||||
[#1142]: https://github.com/benmosher/eslint-plugin-import/pull/1142
|
||||
[#1137]: https://github.com/benmosher/eslint-plugin-import/pull/1137
|
||||
[#1135]: https://github.com/benmosher/eslint-plugin-import/pull/1135
|
||||
[#1128]: https://github.com/benmosher/eslint-plugin-import/pull/1128
|
||||
[#1126]: https://github.com/benmosher/eslint-plugin-import/pull/1126
|
||||
[#1122]: https://github.com/benmosher/eslint-plugin-import/pull/1122
|
||||
[#1112]: https://github.com/benmosher/eslint-plugin-import/pull/1112
|
||||
[#1106]: https://github.com/benmosher/eslint-plugin-import/pull/1106
|
||||
[#1093]: https://github.com/benmosher/eslint-plugin-import/pull/1093
|
||||
[#1085]: https://github.com/benmosher/eslint-plugin-import/pull/1085
|
||||
[#1068]: https://github.com/benmosher/eslint-plugin-import/pull/1068
|
||||
[#1046]: https://github.com/benmosher/eslint-plugin-import/pull/1046
|
||||
[#944]: https://github.com/benmosher/eslint-plugin-import/pull/944
|
||||
[#912]: https://github.com/benmosher/eslint-plugin-import/pull/912
|
||||
[#908]: https://github.com/benmosher/eslint-plugin-import/pull/908
|
||||
[#891]: https://github.com/benmosher/eslint-plugin-import/pull/891
|
||||
[#889]: https://github.com/benmosher/eslint-plugin-import/pull/889
|
||||
[#880]: https://github.com/benmosher/eslint-plugin-import/pull/880
|
||||
[#871]: https://github.com/benmosher/eslint-plugin-import/pull/871
|
||||
[#858]: https://github.com/benmosher/eslint-plugin-import/pull/858
|
||||
[#843]: https://github.com/benmosher/eslint-plugin-import/pull/843
|
||||
[#797]: https://github.com/benmosher/eslint-plugin-import/pull/797
|
||||
[#794]: https://github.com/benmosher/eslint-plugin-import/pull/794
|
||||
[#744]: https://github.com/benmosher/eslint-plugin-import/pull/744
|
||||
[#742]: https://github.com/benmosher/eslint-plugin-import/pull/742
|
||||
[#737]: https://github.com/benmosher/eslint-plugin-import/pull/737
|
||||
[#727]: https://github.com/benmosher/eslint-plugin-import/pull/727
|
||||
[#721]: https://github.com/benmosher/eslint-plugin-import/pull/721
|
||||
[#712]: https://github.com/benmosher/eslint-plugin-import/pull/712
|
||||
[#696]: https://github.com/benmosher/eslint-plugin-import/pull/696
|
||||
[#685]: https://github.com/benmosher/eslint-plugin-import/pull/685
|
||||
[#680]: https://github.com/benmosher/eslint-plugin-import/pull/680
|
||||
[#654]: https://github.com/benmosher/eslint-plugin-import/pull/654
|
||||
[#639]: https://github.com/benmosher/eslint-plugin-import/pull/639
|
||||
[#632]: https://github.com/benmosher/eslint-plugin-import/pull/632
|
||||
[#630]: https://github.com/benmosher/eslint-plugin-import/pull/630
|
||||
[#628]: https://github.com/benmosher/eslint-plugin-import/pull/628
|
||||
[#596]: https://github.com/benmosher/eslint-plugin-import/pull/596
|
||||
[#586]: https://github.com/benmosher/eslint-plugin-import/pull/586
|
||||
[#578]: https://github.com/benmosher/eslint-plugin-import/pull/578
|
||||
[#568]: https://github.com/benmosher/eslint-plugin-import/pull/568
|
||||
[#555]: https://github.com/benmosher/eslint-plugin-import/pull/555
|
||||
[#538]: https://github.com/benmosher/eslint-plugin-import/pull/538
|
||||
[#527]: https://github.com/benmosher/eslint-plugin-import/pull/527
|
||||
[#509]: https://github.com/benmosher/eslint-plugin-import/pull/509
|
||||
[#508]: https://github.com/benmosher/eslint-plugin-import/pull/508
|
||||
[#503]: https://github.com/benmosher/eslint-plugin-import/pull/503
|
||||
[#499]: https://github.com/benmosher/eslint-plugin-import/pull/499
|
||||
[#489]: https://github.com/benmosher/eslint-plugin-import/pull/489
|
||||
[#485]: https://github.com/benmosher/eslint-plugin-import/pull/485
|
||||
[#461]: https://github.com/benmosher/eslint-plugin-import/pull/461
|
||||
[#449]: https://github.com/benmosher/eslint-plugin-import/pull/449
|
||||
[#444]: https://github.com/benmosher/eslint-plugin-import/pull/444
|
||||
[#428]: https://github.com/benmosher/eslint-plugin-import/pull/428
|
||||
[#395]: https://github.com/benmosher/eslint-plugin-import/pull/395
|
||||
[#371]: https://github.com/benmosher/eslint-plugin-import/pull/371
|
||||
[#365]: https://github.com/benmosher/eslint-plugin-import/pull/365
|
||||
[#359]: https://github.com/benmosher/eslint-plugin-import/pull/359
|
||||
[#343]: https://github.com/benmosher/eslint-plugin-import/pull/343
|
||||
[#332]: https://github.com/benmosher/eslint-plugin-import/pull/332
|
||||
[#322]: https://github.com/benmosher/eslint-plugin-import/pull/322
|
||||
[#321]: https://github.com/benmosher/eslint-plugin-import/pull/321
|
||||
[#316]: https://github.com/benmosher/eslint-plugin-import/pull/316
|
||||
[#314]: https://github.com/benmosher/eslint-plugin-import/pull/314
|
||||
[#308]: https://github.com/benmosher/eslint-plugin-import/pull/308
|
||||
[#298]: https://github.com/benmosher/eslint-plugin-import/pull/298
|
||||
[#297]: https://github.com/benmosher/eslint-plugin-import/pull/297
|
||||
[#296]: https://github.com/benmosher/eslint-plugin-import/pull/296
|
||||
[#290]: https://github.com/benmosher/eslint-plugin-import/pull/290
|
||||
[#289]: https://github.com/benmosher/eslint-plugin-import/pull/289
|
||||
[#288]: https://github.com/benmosher/eslint-plugin-import/pull/288
|
||||
[#287]: https://github.com/benmosher/eslint-plugin-import/pull/287
|
||||
[#278]: https://github.com/benmosher/eslint-plugin-import/pull/278
|
||||
[#261]: https://github.com/benmosher/eslint-plugin-import/pull/261
|
||||
[#256]: https://github.com/benmosher/eslint-plugin-import/pull/256
|
||||
[#254]: https://github.com/benmosher/eslint-plugin-import/pull/254
|
||||
[#250]: https://github.com/benmosher/eslint-plugin-import/pull/250
|
||||
[#247]: https://github.com/benmosher/eslint-plugin-import/pull/247
|
||||
[#245]: https://github.com/benmosher/eslint-plugin-import/pull/245
|
||||
[#243]: https://github.com/benmosher/eslint-plugin-import/pull/243
|
||||
[#241]: https://github.com/benmosher/eslint-plugin-import/pull/241
|
||||
[#239]: https://github.com/benmosher/eslint-plugin-import/pull/239
|
||||
[#228]: https://github.com/benmosher/eslint-plugin-import/pull/228
|
||||
[#211]: https://github.com/benmosher/eslint-plugin-import/pull/211
|
||||
[#164]: https://github.com/benmosher/eslint-plugin-import/pull/164
|
||||
[#157]: https://github.com/benmosher/eslint-plugin-import/pull/157
|
||||
|
||||
[#1366]: https://github.com/benmosher/eslint-plugin-import/issues/1366
|
||||
[#1334]: https://github.com/benmosher/eslint-plugin-import/issues/1334
|
||||
[#1323]: https://github.com/benmosher/eslint-plugin-import/issues/1323
|
||||
[#1322]: https://github.com/benmosher/eslint-plugin-import/issues/1322
|
||||
[#1300]: https://github.com/benmosher/eslint-plugin-import/issues/1300
|
||||
[#1293]: https://github.com/benmosher/eslint-plugin-import/issues/1293
|
||||
[#1266]: https://github.com/benmosher/eslint-plugin-import/issues/1266
|
||||
[#1256]: https://github.com/benmosher/eslint-plugin-import/issues/1256
|
||||
[#1233]: https://github.com/benmosher/eslint-plugin-import/issues/1233
|
||||
[#1175]: https://github.com/benmosher/eslint-plugin-import/issues/1175
|
||||
[#1166]: https://github.com/benmosher/eslint-plugin-import/issues/1166
|
||||
[#1144]: https://github.com/benmosher/eslint-plugin-import/issues/1144
|
||||
[#1058]: https://github.com/benmosher/eslint-plugin-import/issues/1058
|
||||
[#1035]: https://github.com/benmosher/eslint-plugin-import/issues/1035
|
||||
[#931]: https://github.com/benmosher/eslint-plugin-import/issues/931
|
||||
[#886]: https://github.com/benmosher/eslint-plugin-import/issues/886
|
||||
[#863]: https://github.com/benmosher/eslint-plugin-import/issues/863
|
||||
[#842]: https://github.com/benmosher/eslint-plugin-import/issues/842
|
||||
[#839]: https://github.com/benmosher/eslint-plugin-import/issues/839
|
||||
[#793]: https://github.com/benmosher/eslint-plugin-import/issues/793
|
||||
[#720]: https://github.com/benmosher/eslint-plugin-import/issues/720
|
||||
[#717]: https://github.com/benmosher/eslint-plugin-import/issues/717
|
||||
[#686]: https://github.com/benmosher/eslint-plugin-import/issues/686
|
||||
[#671]: https://github.com/benmosher/eslint-plugin-import/issues/671
|
||||
[#660]: https://github.com/benmosher/eslint-plugin-import/issues/660
|
||||
[#653]: https://github.com/benmosher/eslint-plugin-import/issues/653
|
||||
[#627]: https://github.com/benmosher/eslint-plugin-import/issues/627
|
||||
[#620]: https://github.com/benmosher/eslint-plugin-import/issues/620
|
||||
[#609]: https://github.com/benmosher/eslint-plugin-import/issues/609
|
||||
[#604]: https://github.com/benmosher/eslint-plugin-import/issues/604
|
||||
[#602]: https://github.com/benmosher/eslint-plugin-import/issues/602
|
||||
[#601]: https://github.com/benmosher/eslint-plugin-import/issues/601
|
||||
[#592]: https://github.com/benmosher/eslint-plugin-import/issues/592
|
||||
[#577]: https://github.com/benmosher/eslint-plugin-import/issues/577
|
||||
[#570]: https://github.com/benmosher/eslint-plugin-import/issues/570
|
||||
[#567]: https://github.com/benmosher/eslint-plugin-import/issues/567
|
||||
[#566]: https://github.com/benmosher/eslint-plugin-import/issues/566
|
||||
[#545]: https://github.com/benmosher/eslint-plugin-import/issues/545
|
||||
[#530]: https://github.com/benmosher/eslint-plugin-import/issues/530
|
||||
[#529]: https://github.com/benmosher/eslint-plugin-import/issues/529
|
||||
[#519]: https://github.com/benmosher/eslint-plugin-import/issues/519
|
||||
[#507]: https://github.com/benmosher/eslint-plugin-import/issues/507
|
||||
[#484]: https://github.com/benmosher/eslint-plugin-import/issues/484
|
||||
[#478]: https://github.com/benmosher/eslint-plugin-import/issues/478
|
||||
[#456]: https://github.com/benmosher/eslint-plugin-import/issues/456
|
||||
[#453]: https://github.com/benmosher/eslint-plugin-import/issues/453
|
||||
[#452]: https://github.com/benmosher/eslint-plugin-import/issues/452
|
||||
[#447]: https://github.com/benmosher/eslint-plugin-import/issues/447
|
||||
[#441]: https://github.com/benmosher/eslint-plugin-import/issues/441
|
||||
[#423]: https://github.com/benmosher/eslint-plugin-import/issues/423
|
||||
[#416]: https://github.com/benmosher/eslint-plugin-import/issues/416
|
||||
[#415]: https://github.com/benmosher/eslint-plugin-import/issues/415
|
||||
[#402]: https://github.com/benmosher/eslint-plugin-import/issues/402
|
||||
[#386]: https://github.com/benmosher/eslint-plugin-import/issues/386
|
||||
[#373]: https://github.com/benmosher/eslint-plugin-import/issues/373
|
||||
[#370]: https://github.com/benmosher/eslint-plugin-import/issues/370
|
||||
[#348]: https://github.com/benmosher/eslint-plugin-import/issues/348
|
||||
[#342]: https://github.com/benmosher/eslint-plugin-import/issues/342
|
||||
[#328]: https://github.com/benmosher/eslint-plugin-import/issues/328
|
||||
[#317]: https://github.com/benmosher/eslint-plugin-import/issues/317
|
||||
[#313]: https://github.com/benmosher/eslint-plugin-import/issues/313
|
||||
[#311]: https://github.com/benmosher/eslint-plugin-import/issues/311
|
||||
[#306]: https://github.com/benmosher/eslint-plugin-import/issues/306
|
||||
[#286]: https://github.com/benmosher/eslint-plugin-import/issues/286
|
||||
[#283]: https://github.com/benmosher/eslint-plugin-import/issues/283
|
||||
[#281]: https://github.com/benmosher/eslint-plugin-import/issues/281
|
||||
[#275]: https://github.com/benmosher/eslint-plugin-import/issues/275
|
||||
[#272]: https://github.com/benmosher/eslint-plugin-import/issues/272
|
||||
[#270]: https://github.com/benmosher/eslint-plugin-import/issues/270
|
||||
[#267]: https://github.com/benmosher/eslint-plugin-import/issues/267
|
||||
[#266]: https://github.com/benmosher/eslint-plugin-import/issues/266
|
||||
[#216]: https://github.com/benmosher/eslint-plugin-import/issues/216
|
||||
[#214]: https://github.com/benmosher/eslint-plugin-import/issues/214
|
||||
[#210]: https://github.com/benmosher/eslint-plugin-import/issues/210
|
||||
[#200]: https://github.com/benmosher/eslint-plugin-import/issues/200
|
||||
[#192]: https://github.com/benmosher/eslint-plugin-import/issues/192
|
||||
[#191]: https://github.com/benmosher/eslint-plugin-import/issues/191
|
||||
[#189]: https://github.com/benmosher/eslint-plugin-import/issues/189
|
||||
[#170]: https://github.com/benmosher/eslint-plugin-import/issues/170
|
||||
[#155]: https://github.com/benmosher/eslint-plugin-import/issues/155
|
||||
[#119]: https://github.com/benmosher/eslint-plugin-import/issues/119
|
||||
[#89]: https://github.com/benmosher/eslint-plugin-import/issues/89
|
||||
|
||||
[Unreleased]: https://github.com/benmosher/eslint-plugin-import/compare/v2.18.0...HEAD
|
||||
[2.18.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.17.3...v2.18.0
|
||||
[2.17.3]: https://github.com/benmosher/eslint-plugin-import/compare/v2.17.2...v2.17.3
|
||||
[2.17.2]: https://github.com/benmosher/eslint-plugin-import/compare/v2.17.1...v2.17.2
|
||||
[2.17.1]: https://github.com/benmosher/eslint-plugin-import/compare/v2.17.0...v2.17.1
|
||||
[2.17.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.16.0...v2.17.0
|
||||
[2.16.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.15.0...v2.16.0
|
||||
[2.15.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.14.0...v2.15.0
|
||||
[2.14.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.13.0...v2.14.0
|
||||
[2.13.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.12.0...v2.13.0
|
||||
[2.12.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.11.0...v2.12.0
|
||||
[2.11.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.10.0...v2.11.0
|
||||
[2.10.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.9.0...v2.10.0
|
||||
[2.9.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.8.0...v2.9.0
|
||||
[2.8.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.7.0...v2.8.0
|
||||
[2.7.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.6.1...v2.7.0
|
||||
[2.6.1]: https://github.com/benmosher/eslint-plugin-import/compare/v2.6.0...v2.6.1
|
||||
[2.6.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.5.0...v2.6.0
|
||||
[2.5.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.4.0...v2.5.0
|
||||
[2.4.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.3.0...v2.4.0
|
||||
[2.3.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.2.0...v2.3.0
|
||||
[2.2.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.1.0...v2.2.0
|
||||
[2.1.0]: https://github.com/benmosher/eslint-plugin-import/compare/v2.0.1...v2.1.0
|
||||
[2.0.1]: https://github.com/benmosher/eslint-plugin-import/compare/v2.0.0...v2.0.1
|
||||
[2.0.0]: https://github.com/benmosher/eslint-plugin-import/compare/v1.16.0...v2.0.0
|
||||
[1.16.0]: https://github.com/benmosher/eslint-plugin-import/compare/v1.15.0...v1.16.0
|
||||
[1.15.0]: https://github.com/benmosher/eslint-plugin-import/compare/v1.14.0...v1.15.0
|
||||
[1.14.0]: https://github.com/benmosher/eslint-plugin-import/compare/v1.13.0...v1.14.0
|
||||
[1.13.0]: https://github.com/benmosher/eslint-plugin-import/compare/v1.12.0...v1.13.0
|
||||
[1.12.0]: https://github.com/benmosher/eslint-plugin-import/compare/v1.11.1...v1.12.0
|
||||
[1.11.1]: https://github.com/benmosher/eslint-plugin-import/compare/v1.11.0...v1.11.1
|
||||
[1.11.0]: https://github.com/benmosher/eslint-plugin-import/compare/v1.10.3...v1.11.0
|
||||
[1.10.3]: https://github.com/benmosher/eslint-plugin-import/compare/v1.10.2...v1.10.3
|
||||
[1.10.2]: https://github.com/benmosher/eslint-plugin-import/compare/v1.10.1...v1.10.2
|
||||
[1.10.1]: https://github.com/benmosher/eslint-plugin-import/compare/v1.10.0...v1.10.1
|
||||
[1.10.0]: https://github.com/benmosher/eslint-plugin-import/compare/v1.9.2...v1.10.0
|
||||
[1.9.2]: https://github.com/benmosher/eslint-plugin-import/compare/v1.9.1...v1.9.2
|
||||
[1.9.1]: https://github.com/benmosher/eslint-plugin-import/compare/v1.9.0...v1.9.1
|
||||
[1.9.0]: https://github.com/benmosher/eslint-plugin-import/compare/v1.8.1...v1.9.0
|
||||
[1.8.1]: https://github.com/benmosher/eslint-plugin-import/compare/v1.8.0...v1.8.1
|
||||
[1.8.0]: https://github.com/benmosher/eslint-plugin-import/compare/v1.7.0...v1.8.0
|
||||
[1.7.0]: https://github.com/benmosher/eslint-plugin-import/compare/v1.6.1...v1.7.0
|
||||
[1.6.1]: https://github.com/benmosher/eslint-plugin-import/compare/v1.6.0...v1.6.1
|
||||
[1.6.0]: https://github.com/benmosher/eslint-plugin-import/compare/v1.5.0...1.6.0
|
||||
[1.5.0]: https://github.com/benmosher/eslint-plugin-import/compare/v1.4.0...v1.5.0
|
||||
[1.4.0]: https://github.com/benmosher/eslint-plugin-import/compare/v1.3.0...v1.4.0
|
||||
[1.3.0]: https://github.com/benmosher/eslint-plugin-import/compare/v1.2.0...v1.3.0
|
||||
[1.2.0]: https://github.com/benmosher/eslint-plugin-import/compare/v1.1.0...v1.2.0
|
||||
[1.1.0]: https://github.com/benmosher/eslint-plugin-import/compare/v1.0.4...v1.1.0
|
||||
[1.0.4]: https://github.com/benmosher/eslint-plugin-import/compare/v1.0.3...v1.0.4
|
||||
[1.0.3]: https://github.com/benmosher/eslint-plugin-import/compare/v1.0.2...v1.0.3
|
||||
[1.0.2]: https://github.com/benmosher/eslint-plugin-import/compare/v1.0.1...v1.0.2
|
||||
[1.0.1]: https://github.com/benmosher/eslint-plugin-import/compare/v1.0.0...v1.0.1
|
||||
[1.0.0]: https://github.com/benmosher/eslint-plugin-import/compare/v1.0.0-beta.0...v1.0.0
|
||||
[1.0.0-beta.0]: https://github.com/benmosher/eslint-plugin-import/compare/v0.13.0...v1.0.0-beta.0
|
||||
[0.13.0]: https://github.com/benmosher/eslint-plugin-import/compare/v0.12.1...v0.13.0
|
||||
[0.12.2]: https://github.com/benmosher/eslint-plugin-import/compare/v0.12.1...v0.12.2
|
||||
[0.12.1]: https://github.com/benmosher/eslint-plugin-import/compare/v0.12.0...v0.12.1
|
||||
[0.12.0]: https://github.com/benmosher/eslint-plugin-import/compare/v0.11.0...v0.12.0
|
||||
[0.11.0]: https://github.com/benmosher/eslint-plugin-import/compare/v0.10.1...v0.11.0
|
||||
|
||||
[@mathieudutour]: https://github.com/mathieudutour
|
||||
[@gausie]: https://github.com/gausie
|
||||
[@singles]: https://github.com/singles
|
||||
[@jfmengels]: https://github.com/jfmengels
|
||||
[@lo1tuma]: https://github.com/lo1tuma
|
||||
[@dmnd]: https://github.com/dmnd
|
||||
[@lemonmade]: https://github.com/lemonmade
|
||||
[@jimbolla]: https://github.com/jimbolla
|
||||
[@jquense]: https://github.com/jquense
|
||||
[@jonboiser]: https://github.com/jonboiser
|
||||
[@taion]: https://github.com/taion
|
||||
[@strawbrary]: https://github.com/strawbrary
|
||||
[@SimenB]: https://github.com/SimenB
|
||||
[@josh]: https://github.com/josh
|
||||
[@borisyankov]: https://github.com/borisyankov
|
||||
[@gavriguy]: https://github.com/gavriguy
|
||||
[@jkimbo]: https://github.com/jkimbo
|
||||
[@le0nik]: https://github.com/le0nik
|
||||
[@scottnonnenberg]: https://github.com/scottnonnenberg
|
||||
[@sindresorhus]: https://github.com/sindresorhus
|
||||
[@ljharb]: https://github.com/ljharb
|
||||
[@rhettlivingston]: https://github.com/rhettlivingston
|
||||
[@zloirock]: https://github.com/zloirock
|
||||
[@rhys-vdw]: https://github.com/rhys-vdw
|
||||
[@wKich]: https://github.com/wKich
|
||||
[@tizmagik]: https://github.com/tizmagik
|
||||
[@knpwrs]: https://github.com/knpwrs
|
||||
[@spalger]: https://github.com/spalger
|
||||
[@preco21]: https://github.com/preco21
|
||||
[@skyrpex]: https://github.com/skyrpex
|
||||
[@fson]: https://github.com/fson
|
||||
[@ntdb]: https://github.com/ntdb
|
||||
[@jakubsta]: https://github.com/jakubsta
|
||||
[@wtgtybhertgeghgtwtg]: https://github.com/wtgtybhertgeghgtwtg
|
||||
[@duncanbeevers]: https://github.com/duncanbeevers
|
||||
[@giodamelio]: https://github.com/giodamelio
|
||||
[@ntdb]: https://github.com/ntdb
|
||||
[@ramasilveyra]: https://github.com/ramasilveyra
|
||||
[@sompylasar]: https://github.com/sompylasar
|
||||
[@kevin940726]: https://github.com/kevin940726
|
||||
[@eelyafi]: https://github.com/eelyafi
|
||||
[@mastilver]: https://github.com/mastilver
|
||||
[@jseminck]: https://github.com/jseminck
|
||||
[@laysent]: https://github.com/laysent
|
||||
[@k15a]: https://github.com/k15a
|
||||
[@mplewis]: https://github.com/mplewis
|
||||
[@rosswarren]: https://github.com/rosswarren
|
||||
[@alexgorbatchev]: https://github.com/alexgorbatchev
|
||||
[@tihonove]: https://github.com/tihonove
|
||||
[@robertrossmann]: https://github.com/robertrossmann
|
||||
[@isiahmeadows]: https://github.com/isiahmeadows
|
||||
[@graingert]: https://github.com/graingert
|
||||
[@danny-andrews]: https://github.com/dany-andrews
|
||||
[@fengkfengk]: https://github.com/fengkfengk
|
||||
[@futpib]: https://github.com/futpib
|
||||
[@klimashkin]: https://github.com/klimashkin
|
||||
[@lukeapage]: https://github.com/lukeapage
|
||||
[@manovotny]: https://github.com/manovotny
|
||||
[@mattijsbliek]: https://github.com/mattijsbliek
|
||||
[@hulkish]: https://github.com/hulkish
|
||||
[@chrislloyd]: https://github.com/chrislloyd
|
||||
[@ai]: https://github.com/ai
|
||||
[@syymza]: https://github.com/syymza
|
||||
[@justinanastos]: https://github.com/justinanastos
|
||||
[@1pete]: https://github.com/1pete
|
||||
[@gajus]: https://github.com/gajus
|
||||
[@jf248]: https://github.com/jf248
|
||||
[@aravindet]: https://github.com/aravindet
|
||||
[@pzhine]: https://github.com/pzhine
|
||||
[@st-sloth]: https://github.com/st-sloth
|
||||
[@ljqx]: https://github.com/ljqx
|
||||
[@kirill-konshin]: https://github.com/kirill-konshin
|
||||
[@asapach]: https://github.com/asapach
|
||||
[@sergei-startsev]: https://github.com/sergei-startsev
|
||||
[@ephys]: https://github.com/ephys
|
||||
[@lydell]: https://github.com/lydell
|
||||
[@jeffshaver]: https://github.com/jeffshaver
|
||||
[@timkraut]: https://github.com/timkraut
|
||||
[@TakeScoop]: https://github.com/TakeScoop
|
||||
[@rfermann]: https://github.com/rfermann
|
||||
[@bradennapier]: https://github.com/bradennapier
|
||||
[@schmod]: https://github.com/schmod
|
||||
[@echenley]: https://github.com/echenley
|
||||
[@vikr01]: https://github.com/vikr01
|
||||
[@bradzacher]: https://github.com/bradzacher
|
||||
[@feychenie]: https://github.com/feychenie
|
||||
[@kiwka]: https://github.com/kiwka
|
||||
[@loganfsmyth]: https://github.com/loganfsmyth
|
||||
[@johndevedu]: https://github.com/johndevedu
|
||||
[@charlessuh]: https://github.com/charlessuh
|
||||
[@kgregory]: https://github.com/kgregory
|
||||
[@christophercurrie]: https://github.com/christophercurrie
|
||||
[@alex-page]: https://github.com/alex-page
|
||||
[@benmosher]: https://github.com/benmosher
|
||||
[@fooloomanzoo]: https://github.com/fooloomanzoo
|
||||
[@sheepsteak]: https://github.com/sheepsteak
|
||||
[@sharmilajesupaul]: https://github.com/sharmilajesupaul
|
||||
[@lencioni]: https://github.com/lencioni
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Ben Mosher
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
+475
@@ -0,0 +1,475 @@
|
||||
# eslint-plugin-import
|
||||
|
||||
[](https://travis-ci.org/benmosher/eslint-plugin-import)
|
||||
[](https://coveralls.io/github/benmosher/eslint-plugin-import?branch=master)
|
||||
[](https://ci.appveyor.com/project/benmosher/eslint-plugin-import/branch/master)
|
||||
[](https://www.npmjs.com/package/eslint-plugin-import)
|
||||
[](http://www.npmtrends.com/eslint-plugin-import)
|
||||
|
||||
This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, and prevent issues with misspelling of file paths and import names. All the goodness that the ES2015+ static module syntax intends to provide, marked up in your editor.
|
||||
|
||||
**IF YOU ARE USING THIS WITH SUBLIME**: see the [bottom section](#sublimelinter-eslint) for important info.
|
||||
|
||||
## Rules
|
||||
|
||||
### Static analysis
|
||||
|
||||
* Ensure imports point to a file/module that can be resolved. ([`no-unresolved`])
|
||||
* Ensure named imports correspond to a named export in the remote file. ([`named`])
|
||||
* Ensure a default export is present, given a default import. ([`default`])
|
||||
* Ensure imported namespaces contain dereferenced properties as they are dereferenced. ([`namespace`])
|
||||
* Restrict which files can be imported in a given folder ([`no-restricted-paths`])
|
||||
* Forbid import of modules using absolute paths ([`no-absolute-path`])
|
||||
* Forbid `require()` calls with expressions ([`no-dynamic-require`])
|
||||
* Prevent importing the submodules of other modules ([`no-internal-modules`])
|
||||
* Forbid webpack loader syntax in imports ([`no-webpack-loader-syntax`])
|
||||
* Forbid a module from importing itself ([`no-self-import`])
|
||||
* Forbid a module from importing a module with a dependency path back to itself ([`no-cycle`])
|
||||
* Prevent unnecessary path segments in import and require statements ([`no-useless-path-segments`])
|
||||
* Forbid importing modules from parent directories ([`no-relative-parent-imports`])
|
||||
* Forbid modules without any export, and exports not imported by any modules. ([`no-unused-modules`])
|
||||
|
||||
[`no-unresolved`]: ./docs/rules/no-unresolved.md
|
||||
[`named`]: ./docs/rules/named.md
|
||||
[`default`]: ./docs/rules/default.md
|
||||
[`namespace`]: ./docs/rules/namespace.md
|
||||
[`no-restricted-paths`]: ./docs/rules/no-restricted-paths.md
|
||||
[`no-absolute-path`]: ./docs/rules/no-absolute-path.md
|
||||
[`no-dynamic-require`]: ./docs/rules/no-dynamic-require.md
|
||||
[`no-internal-modules`]: ./docs/rules/no-internal-modules.md
|
||||
[`no-webpack-loader-syntax`]: ./docs/rules/no-webpack-loader-syntax.md
|
||||
[`no-self-import`]: ./docs/rules/no-self-import.md
|
||||
[`no-cycle`]: ./docs/rules/no-cycle.md
|
||||
[`no-useless-path-segments`]: ./docs/rules/no-useless-path-segments.md
|
||||
[`no-relative-parent-imports`]: ./docs/rules/no-relative-parent-imports.md
|
||||
[`no-unused-modules`]: ./docs/rules/no-unused-modules.md
|
||||
|
||||
### Helpful warnings
|
||||
|
||||
|
||||
* Report any invalid exports, i.e. re-export of the same name ([`export`])
|
||||
* Report use of exported name as identifier of default export ([`no-named-as-default`])
|
||||
* Report use of exported name as property of default export ([`no-named-as-default-member`])
|
||||
* Report imported names marked with `@deprecated` documentation tag ([`no-deprecated`])
|
||||
* Forbid the use of extraneous packages ([`no-extraneous-dependencies`])
|
||||
* Forbid the use of mutable exports with `var` or `let`. ([`no-mutable-exports`])
|
||||
* Report modules without exports, or exports without matching import in another module ([`no-unused-modules`])
|
||||
|
||||
[`export`]: ./docs/rules/export.md
|
||||
[`no-named-as-default`]: ./docs/rules/no-named-as-default.md
|
||||
[`no-named-as-default-member`]: ./docs/rules/no-named-as-default-member.md
|
||||
[`no-deprecated`]: ./docs/rules/no-deprecated.md
|
||||
[`no-extraneous-dependencies`]: ./docs/rules/no-extraneous-dependencies.md
|
||||
[`no-mutable-exports`]: ./docs/rules/no-mutable-exports.md
|
||||
[`no-unused-modules`]: ./docs/rules/no-unused-modules.md
|
||||
|
||||
### Module systems
|
||||
|
||||
* Report potentially ambiguous parse goal (`script` vs. `module`) ([`unambiguous`])
|
||||
* Report CommonJS `require` calls and `module.exports` or `exports.*`. ([`no-commonjs`])
|
||||
* Report AMD `require` and `define` calls. ([`no-amd`])
|
||||
* No Node.js builtin modules. ([`no-nodejs-modules`])
|
||||
|
||||
[`unambiguous`]: ./docs/rules/unambiguous.md
|
||||
[`no-commonjs`]: ./docs/rules/no-commonjs.md
|
||||
[`no-amd`]: ./docs/rules/no-amd.md
|
||||
[`no-nodejs-modules`]: ./docs/rules/no-nodejs-modules.md
|
||||
|
||||
|
||||
### Style guide
|
||||
|
||||
* Ensure all imports appear before other statements ([`first`])
|
||||
* Ensure all exports appear after other statements ([`exports-last`])
|
||||
* Report repeated import of the same module in multiple places ([`no-duplicates`])
|
||||
* Report namespace imports ([`no-namespace`])
|
||||
* Ensure consistent use of file extension within the import path ([`extensions`])
|
||||
* Enforce a convention in module import order ([`order`])
|
||||
* Enforce a newline after import statements ([`newline-after-import`])
|
||||
* Prefer a default export if module exports a single name ([`prefer-default-export`])
|
||||
* Limit the maximum number of dependencies a module can have ([`max-dependencies`])
|
||||
* Forbid unassigned imports ([`no-unassigned-import`])
|
||||
* Forbid named default exports ([`no-named-default`])
|
||||
* Forbid default exports ([`no-default-export`])
|
||||
* Forbid named exports ([`no-named-export`])
|
||||
* Forbid anonymous values as default exports ([`no-anonymous-default-export`])
|
||||
* Prefer named exports to be grouped together in a single export declaration ([`group-exports`])
|
||||
* Enforce a leading comment with the webpackChunkName for dynamic imports ([`dynamic-import-chunkname`])
|
||||
|
||||
[`first`]: ./docs/rules/first.md
|
||||
[`exports-last`]: ./docs/rules/exports-last.md
|
||||
[`no-duplicates`]: ./docs/rules/no-duplicates.md
|
||||
[`no-namespace`]: ./docs/rules/no-namespace.md
|
||||
[`extensions`]: ./docs/rules/extensions.md
|
||||
[`order`]: ./docs/rules/order.md
|
||||
[`newline-after-import`]: ./docs/rules/newline-after-import.md
|
||||
[`prefer-default-export`]: ./docs/rules/prefer-default-export.md
|
||||
[`max-dependencies`]: ./docs/rules/max-dependencies.md
|
||||
[`no-unassigned-import`]: ./docs/rules/no-unassigned-import.md
|
||||
[`no-named-default`]: ./docs/rules/no-named-default.md
|
||||
[`no-anonymous-default-export`]: ./docs/rules/no-anonymous-default-export.md
|
||||
[`group-exports`]: ./docs/rules/group-exports.md
|
||||
[`no-default-export`]: ./docs/rules/no-default-export.md
|
||||
[`no-named-export`]: ./docs/rules/no-named-export.md
|
||||
[`dynamic-import-chunkname`]: ./docs/rules/dynamic-import-chunkname.md
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install eslint-plugin-import -g
|
||||
```
|
||||
|
||||
or if you manage ESLint as a dev dependency:
|
||||
|
||||
```sh
|
||||
# inside your project's working tree
|
||||
npm install eslint-plugin-import --save-dev
|
||||
```
|
||||
|
||||
All rules are off by default. However, you may configure them manually
|
||||
in your `.eslintrc.(yml|json|js)`, or extend one of the canned configs:
|
||||
|
||||
```yaml
|
||||
---
|
||||
extends:
|
||||
- eslint:recommended
|
||||
- plugin:import/errors
|
||||
- plugin:import/warnings
|
||||
|
||||
# or configure manually:
|
||||
plugins:
|
||||
- import
|
||||
|
||||
rules:
|
||||
import/no-unresolved: [2, {commonjs: true, amd: true}]
|
||||
import/named: 2
|
||||
import/namespace: 2
|
||||
import/default: 2
|
||||
import/export: 2
|
||||
# etc...
|
||||
```
|
||||
|
||||
# Typescript
|
||||
|
||||
You may use the following shortcut or assemble your own config using the granular settings described below.
|
||||
|
||||
Make sure you have installed [`@typescript-eslint/parser`] which is used in the following configuration. Unfortunately NPM does not allow to list optional peer dependencies.
|
||||
|
||||
```yaml
|
||||
extends:
|
||||
- eslint:recommended
|
||||
- plugin:import/errors
|
||||
- plugin:import/warnings
|
||||
- plugin:import/typescript # this line does the trick
|
||||
```
|
||||
|
||||
[`@typescript-eslint/parser`]: https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser
|
||||
|
||||
# Resolvers
|
||||
|
||||
With the advent of module bundlers and the current state of modules and module
|
||||
syntax specs, it's not always obvious where `import x from 'module'` should look
|
||||
to find the file behind `module`.
|
||||
|
||||
Up through v0.10ish, this plugin has directly used substack's [`resolve`] plugin,
|
||||
which implements Node's import behavior. This works pretty well in most cases.
|
||||
|
||||
However, webpack allows a number of things in import module source strings that
|
||||
Node does not, such as loaders (`import 'file!./whatever'`) and a number of
|
||||
aliasing schemes, such as [`externals`]: mapping a module id to a global name at
|
||||
runtime (allowing some modules to be included more traditionally via script tags).
|
||||
|
||||
In the interest of supporting both of these, v0.11 introduces resolvers.
|
||||
|
||||
Currently [Node] and [webpack] resolution have been implemented, but the
|
||||
resolvers are just npm packages, so [third party packages are supported](https://github.com/benmosher/eslint-plugin-import/wiki/Resolvers) (and encouraged!).
|
||||
|
||||
You can reference resolvers in several ways (in order of precedence):
|
||||
|
||||
- as a conventional `eslint-import-resolver` name, like `eslint-import-resolver-foo`:
|
||||
|
||||
```yaml
|
||||
# .eslintrc.yml
|
||||
settings:
|
||||
# uses 'eslint-import-resolver-foo':
|
||||
import/resolver: foo
|
||||
```
|
||||
```js
|
||||
// .eslintrc.js
|
||||
module.exports = {
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
foo: { someConfig: value }
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- with a full npm module name, like `my-awesome-npm-module`:
|
||||
|
||||
```yaml
|
||||
# .eslintrc.yml
|
||||
settings:
|
||||
import/resolver: 'my-awesome-npm-module'
|
||||
```
|
||||
```js
|
||||
// .eslintrc.js
|
||||
module.exports = {
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
'my-awesome-npm-module': { someConfig: value }
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- with a filesystem path to resolver, defined in this example as a `computed property` name:
|
||||
|
||||
```js
|
||||
// .eslintrc.js
|
||||
module.exports = {
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
[path.resolve('../../../my-resolver')]: { someConfig: value }
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Relative paths will be resolved relative to the source's nearest `package.json` or
|
||||
the process's current working directory if no `package.json` is found.
|
||||
|
||||
|
||||
|
||||
If you are interesting in writing a resolver, see the [spec](./resolvers/README.md) for more details.
|
||||
|
||||
[`resolve`]: https://www.npmjs.com/package/resolve
|
||||
[`externals`]: http://webpack.github.io/docs/library-and-externals.html
|
||||
|
||||
[Node]: https://www.npmjs.com/package/eslint-import-resolver-node
|
||||
[webpack]: https://www.npmjs.com/package/eslint-import-resolver-webpack
|
||||
|
||||
# Settings
|
||||
|
||||
You may set the following settings in your `.eslintrc`:
|
||||
|
||||
#### `import/extensions`
|
||||
|
||||
A list of file extensions that will be parsed as modules and inspected for
|
||||
`export`s.
|
||||
|
||||
This defaults to `['.js']`, unless you are using the `react` shared config,
|
||||
in which case it is specified as `['.js', '.jsx']`.
|
||||
|
||||
```js
|
||||
"settings": {
|
||||
"import/extensions": [
|
||||
".js",
|
||||
".jsx"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
If you require more granular extension definitions, you can use:
|
||||
|
||||
```js
|
||||
"settings": {
|
||||
"import/resolver": {
|
||||
"node": {
|
||||
"extensions": [
|
||||
".js",
|
||||
".jsx"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Note that this is different from (and likely a subset of) any `import/resolver`
|
||||
extensions settings, which may include `.json`, `.coffee`, etc. which will still
|
||||
factor into the `no-unresolved` rule.
|
||||
|
||||
Also, the following `import/ignore` patterns will overrule this list.
|
||||
|
||||
#### `import/ignore`
|
||||
|
||||
A list of regex strings that, if matched by a path, will
|
||||
not report the matching module if no `export`s are found.
|
||||
In practice, this means rules other than [`no-unresolved`](./docs/rules/no-unresolved.md#ignore) will not report on any
|
||||
`import`s with (absolute filesystem) paths matching this pattern.
|
||||
|
||||
`no-unresolved` has its own [`ignore`](./docs/rules/no-unresolved.md#ignore) setting.
|
||||
|
||||
```yaml
|
||||
settings:
|
||||
import/ignore:
|
||||
- \.coffee$ # fraught with parse errors
|
||||
- \.(scss|less|css)$ # can't parse unprocessed CSS modules, either
|
||||
```
|
||||
|
||||
#### `import/core-modules`
|
||||
|
||||
An array of additional modules to consider as "core" modules--modules that should
|
||||
be considered resolved but have no path on the filesystem. Your resolver may
|
||||
already define some of these (for example, the Node resolver knows about `fs` and
|
||||
`path`), so you need not redefine those.
|
||||
|
||||
For example, Electron exposes an `electron` module:
|
||||
|
||||
```js
|
||||
import 'electron' // without extra config, will be flagged as unresolved!
|
||||
```
|
||||
|
||||
that would otherwise be unresolved. To avoid this, you may provide `electron` as a
|
||||
core module:
|
||||
|
||||
```yaml
|
||||
# .eslintrc.yml
|
||||
settings:
|
||||
import/core-modules: [ electron ]
|
||||
```
|
||||
|
||||
In Electron's specific case, there is a shared config named `electron`
|
||||
that specifies this for you.
|
||||
|
||||
Contribution of more such shared configs for other platforms are welcome!
|
||||
|
||||
#### `import/external-module-folders`
|
||||
|
||||
An array of folders. Resolved modules only from those folders will be considered as "external". By default - `["node_modules"]`. Makes sense if you have configured your path or webpack to handle your internal paths differently and want to considered modules from some folders, for example `bower_components` or `jspm_modules`, as "external".
|
||||
|
||||
#### `import/parsers`
|
||||
|
||||
A map from parsers to file extension arrays. If a file extension is matched, the
|
||||
dependency parser will require and use the map key as the parser instead of the
|
||||
configured ESLint parser. This is useful if you're inter-op-ing with TypeScript
|
||||
directly using webpack, for example:
|
||||
|
||||
```yaml
|
||||
# .eslintrc.yml
|
||||
settings:
|
||||
import/parsers:
|
||||
@typescript-eslint/parser: [ .ts, .tsx ]
|
||||
```
|
||||
|
||||
In this case, [`@typescript-eslint/parser`](https://www.npmjs.com/package/@typescript-eslint/parser)
|
||||
must be installed and require-able from the running `eslint` module's location
|
||||
(i.e., install it as a peer of ESLint).
|
||||
|
||||
This is currently only tested with `@typescript-eslint/parser` (and its predecessor,
|
||||
`typescript-eslint-parser`) but should theoretically work with any moderately
|
||||
ESTree-compliant parser.
|
||||
|
||||
It's difficult to say how well various plugin features will be supported, too,
|
||||
depending on how far down the rabbit hole goes. Submit an issue if you find strange
|
||||
behavior beyond here, but steel your heart against the likely outcome of closing
|
||||
with `wontfix`.
|
||||
|
||||
|
||||
#### `import/resolver`
|
||||
|
||||
See [resolvers](#resolvers).
|
||||
|
||||
#### `import/cache`
|
||||
|
||||
Settings for cache behavior. Memoization is used at various levels to avoid the copious amount of `fs.statSync`/module parse calls required to correctly report errors.
|
||||
|
||||
For normal `eslint` console runs, the cache lifetime is irrelevant, as we can strongly assume that files should not be changing during the lifetime of the linter process (and thus, the cache in memory)
|
||||
|
||||
For long-lasting processes, like [`eslint_d`] or [`eslint-loader`], however, it's important that there be some notion of staleness.
|
||||
|
||||
If you never use [`eslint_d`] or [`eslint-loader`], you may set the cache lifetime to `Infinity` and everything should be fine:
|
||||
|
||||
```yaml
|
||||
# .eslintrc.yml
|
||||
settings:
|
||||
import/cache:
|
||||
lifetime: ∞ # or Infinity
|
||||
```
|
||||
|
||||
Otherwise, set some integer, and cache entries will be evicted after that many seconds have elapsed:
|
||||
|
||||
```yaml
|
||||
# .eslintrc.yml
|
||||
settings:
|
||||
import/cache:
|
||||
lifetime: 5 # 30 is the default
|
||||
```
|
||||
|
||||
[`eslint_d`]: https://www.npmjs.com/package/eslint_d
|
||||
[`eslint-loader`]: https://www.npmjs.com/package/eslint-loader
|
||||
|
||||
|
||||
## SublimeLinter-eslint
|
||||
|
||||
SublimeLinter-eslint introduced a change to support `.eslintignore` files
|
||||
which altered the way file paths are passed to ESLint when linting during editing.
|
||||
This change sends a relative path instead of the absolute path to the file (as ESLint
|
||||
normally provides), which can make it impossible for this plugin to resolve dependencies
|
||||
on the filesystem.
|
||||
|
||||
This workaround should no longer be necessary with the release of ESLint 2.0, when
|
||||
`.eslintignore` will be updated to work more like a `.gitignore`, which should
|
||||
support proper ignoring of absolute paths via `--stdin-filename`.
|
||||
|
||||
In the meantime, see [roadhump/SublimeLinter-eslint#58](https://github.com/roadhump/SublimeLinter-eslint/issues/58)
|
||||
for more details and discussion, but essentially, you may find you need to add the following
|
||||
`SublimeLinter` config to your Sublime project file:
|
||||
|
||||
```json
|
||||
{
|
||||
"folders":
|
||||
[
|
||||
{
|
||||
"path": "code"
|
||||
}
|
||||
],
|
||||
"SublimeLinter":
|
||||
{
|
||||
"linters":
|
||||
{
|
||||
"eslint":
|
||||
{
|
||||
"chdir": "${project}/code"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Note that `${project}/code` matches the `code` provided at `folders[0].path`.
|
||||
|
||||
The purpose of the `chdir` setting, in this case, is to set the working directory
|
||||
from which ESLint is executed to be the same as the directory on which SublimeLinter-eslint
|
||||
bases the relative path it provides.
|
||||
|
||||
See the SublimeLinter docs on [`chdir`](http://www.sublimelinter.com/en/latest/linter_settings.html#chdir)
|
||||
for more information, in case this does not work with your project.
|
||||
|
||||
If you are not using `.eslintignore`, or don't have a Sublime project file, you can also
|
||||
do the following via a `.sublimelinterrc` file in some ancestor directory of your
|
||||
code:
|
||||
|
||||
```json
|
||||
{
|
||||
"linters": {
|
||||
"eslint": {
|
||||
"args": ["--stdin-filename", "@"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
I also found that I needed to set `rc_search_limit` to `null`, which removes the file
|
||||
hierarchy search limit when looking up the directory tree for `.sublimelinterrc`:
|
||||
|
||||
In Package Settings / SublimeLinter / User Settings:
|
||||
```json
|
||||
{
|
||||
"user": {
|
||||
"rc_search_limit": null
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
I believe this defaults to `3`, so you may not need to alter it depending on your
|
||||
project folder max depth.
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Default settings for Electron applications.
|
||||
*/
|
||||
module.exports = {
|
||||
settings: {
|
||||
'import/core-modules': ['electron'],
|
||||
},
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* unopinionated config. just the things that are necessarily runtime errors
|
||||
* waiting to happen.
|
||||
* @type {Object}
|
||||
*/
|
||||
module.exports = {
|
||||
plugins: ['import'],
|
||||
rules: { 'import/no-unresolved': 2
|
||||
, 'import/named': 2
|
||||
, 'import/namespace': 2
|
||||
, 'import/default': 2
|
||||
, 'import/export': 2
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* - adds platform extensions to Node resolver
|
||||
*/
|
||||
module.exports = {
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
node: {
|
||||
// Note: will not complain if only _one_ of these files exists.
|
||||
extensions: ['.js', '.web.js', '.ios.js', '.android.js'],
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Adds `.jsx` as an extension, and enables JSX parsing.
|
||||
*
|
||||
* Even if _you_ aren't using JSX (or .jsx) directly, if your dependencies
|
||||
* define jsnext:main and have JSX internally, you may run into problems
|
||||
* if you don't enable these settings at the top level.
|
||||
*/
|
||||
module.exports = {
|
||||
|
||||
settings: {
|
||||
'import/extensions': ['.js', '.jsx'],
|
||||
},
|
||||
|
||||
parserOptions: {
|
||||
ecmaFeatures: { jsx: true },
|
||||
},
|
||||
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* The basics.
|
||||
* @type {Object}
|
||||
*/
|
||||
module.exports = {
|
||||
plugins: ['import'],
|
||||
|
||||
rules: {
|
||||
// analysis/correctness
|
||||
'import/no-unresolved': 'error',
|
||||
'import/named': 'error',
|
||||
'import/namespace': 'error',
|
||||
'import/default': 'error',
|
||||
'import/export': 'error',
|
||||
|
||||
// red flags (thus, warnings)
|
||||
'import/no-named-as-default': 'warn',
|
||||
'import/no-named-as-default-member': 'warn',
|
||||
'import/no-duplicates': 'warn'
|
||||
},
|
||||
|
||||
// need all these for parsing dependencies (even if _your_ code doesn't need
|
||||
// all of them)
|
||||
parserOptions: {
|
||||
sourceType: 'module',
|
||||
ecmaVersion: 2018,
|
||||
},
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Rules in progress.
|
||||
*
|
||||
* Do not expect these to adhere to semver across releases.
|
||||
* @type {Object}
|
||||
*/
|
||||
module.exports = {
|
||||
plugins: ['import'],
|
||||
rules: {
|
||||
'import/no-deprecated': 1,
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Adds `.jsx`, `.ts` and `.tsx` as an extension, and enables JSX/TSX parsing.
|
||||
*/
|
||||
|
||||
var allExtensions = ['.ts', '.tsx', '.d.ts', '.js', '.jsx'];
|
||||
|
||||
module.exports = {
|
||||
|
||||
settings: {
|
||||
'import/extensions': allExtensions,
|
||||
'import/parsers': {
|
||||
'@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts']
|
||||
},
|
||||
'import/resolver': {
|
||||
'node': {
|
||||
'extensions': allExtensions
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* more opinionated config.
|
||||
* @type {Object}
|
||||
*/
|
||||
module.exports = {
|
||||
plugins: ['import'],
|
||||
rules: {
|
||||
'import/no-named-as-default': 1,
|
||||
'import/no-named-as-default-member': 1,
|
||||
'import/no-duplicates': 1,
|
||||
},
|
||||
}
|
||||
+635
File diff suppressed because one or more lines are too long
+138
File diff suppressed because one or more lines are too long
+11
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = isStaticRequire;
|
||||
// todo: merge with module visitor
|
||||
function isStaticRequire(node) {
|
||||
return node && node.callee && node.callee.type === 'Identifier' && node.callee.name === 'require' && node.arguments.length === 1 && node.arguments[0].type === 'Literal' && typeof node.arguments[0].value === 'string';
|
||||
}
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb3JlL3N0YXRpY1JlcXVpcmUuanMiXSwibmFtZXMiOlsiaXNTdGF0aWNSZXF1aXJlIiwibm9kZSIsImNhbGxlZSIsInR5cGUiLCJuYW1lIiwiYXJndW1lbnRzIiwibGVuZ3RoIiwidmFsdWUiXSwibWFwcGluZ3MiOiI7Ozs7O2tCQUN3QkEsZTtBQUR4QjtBQUNlLFNBQVNBLGVBQVQsQ0FBeUJDLElBQXpCLEVBQStCO0FBQzVDLFNBQU9BLFFBQ0xBLEtBQUtDLE1BREEsSUFFTEQsS0FBS0MsTUFBTCxDQUFZQyxJQUFaLEtBQXFCLFlBRmhCLElBR0xGLEtBQUtDLE1BQUwsQ0FBWUUsSUFBWixLQUFxQixTQUhoQixJQUlMSCxLQUFLSSxTQUFMLENBQWVDLE1BQWYsS0FBMEIsQ0FKckIsSUFLTEwsS0FBS0ksU0FBTCxDQUFlLENBQWYsRUFBa0JGLElBQWxCLEtBQTJCLFNBTHRCLElBTUwsT0FBT0YsS0FBS0ksU0FBTCxDQUFlLENBQWYsRUFBa0JFLEtBQXpCLEtBQW1DLFFBTnJDO0FBT0QiLCJmaWxlIjoic3RhdGljUmVxdWlyZS5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vIHRvZG86IG1lcmdlIHdpdGggbW9kdWxlIHZpc2l0b3JcbmV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIGlzU3RhdGljUmVxdWlyZShub2RlKSB7XG4gIHJldHVybiBub2RlICYmXG4gICAgbm9kZS5jYWxsZWUgJiZcbiAgICBub2RlLmNhbGxlZS50eXBlID09PSAnSWRlbnRpZmllcicgJiZcbiAgICBub2RlLmNhbGxlZS5uYW1lID09PSAncmVxdWlyZScgJiZcbiAgICBub2RlLmFyZ3VtZW50cy5sZW5ndGggPT09IDEgJiZcbiAgICBub2RlLmFyZ3VtZW50c1swXS50eXBlID09PSAnTGl0ZXJhbCcgJiZcbiAgICB0eXBlb2Ygbm9kZS5hcmd1bWVudHNbMF0udmFsdWUgPT09ICdzdHJpbmcnXG59XG4iXX0=
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = docsUrl;
|
||||
|
||||
var _package = require('../package.json');
|
||||
|
||||
var _package2 = _interopRequireDefault(_package);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const repoUrl = 'https://github.com/benmosher/eslint-plugin-import';
|
||||
|
||||
function docsUrl(ruleName) {
|
||||
let commitish = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : `v${_package2.default.version}`;
|
||||
|
||||
return `${repoUrl}/blob/${commitish}/docs/rules/${ruleName}.md`;
|
||||
}
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9kb2NzVXJsLmpzIl0sIm5hbWVzIjpbImRvY3NVcmwiLCJyZXBvVXJsIiwicnVsZU5hbWUiLCJjb21taXRpc2giLCJwa2ciLCJ2ZXJzaW9uIl0sIm1hcHBpbmdzIjoiOzs7OztrQkFJd0JBLE87O0FBSnhCOzs7Ozs7QUFFQSxNQUFNQyxVQUFVLG1EQUFoQjs7QUFFZSxTQUFTRCxPQUFULENBQWlCRSxRQUFqQixFQUEwRDtBQUFBLE1BQS9CQyxTQUErQix1RUFBbEIsSUFBR0Msa0JBQUlDLE9BQVEsRUFBRzs7QUFDdkUsU0FBUSxHQUFFSixPQUFRLFNBQVFFLFNBQVUsZUFBY0QsUUFBUyxLQUEzRDtBQUNEIiwiZmlsZSI6ImRvY3NVcmwuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgcGtnIGZyb20gJy4uL3BhY2thZ2UuanNvbidcblxuY29uc3QgcmVwb1VybCA9ICdodHRwczovL2dpdGh1Yi5jb20vYmVubW9zaGVyL2VzbGludC1wbHVnaW4taW1wb3J0J1xuXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiBkb2NzVXJsKHJ1bGVOYW1lLCBjb21taXRpc2ggPSBgdiR7cGtnLnZlcnNpb259YCkge1xuICByZXR1cm4gYCR7cmVwb1VybH0vYmxvYi8ke2NvbW1pdGlzaH0vZG9jcy9ydWxlcy8ke3J1bGVOYW1lfS5tZGBcbn1cbiJdfQ==
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = importDeclaration;
|
||||
function importDeclaration(context) {
|
||||
var ancestors = context.getAncestors();
|
||||
return ancestors[ancestors.length - 1];
|
||||
}
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbXBvcnREZWNsYXJhdGlvbi5qcyJdLCJuYW1lcyI6WyJpbXBvcnREZWNsYXJhdGlvbiIsImNvbnRleHQiLCJhbmNlc3RvcnMiLCJnZXRBbmNlc3RvcnMiLCJsZW5ndGgiXSwibWFwcGluZ3MiOiI7Ozs7O2tCQUF3QkEsaUI7QUFBVCxTQUFTQSxpQkFBVCxDQUEyQkMsT0FBM0IsRUFBb0M7QUFDakQsTUFBSUMsWUFBWUQsUUFBUUUsWUFBUixFQUFoQjtBQUNBLFNBQU9ELFVBQVVBLFVBQVVFLE1BQVYsR0FBbUIsQ0FBN0IsQ0FBUDtBQUNEIiwiZmlsZSI6ImltcG9ydERlY2xhcmF0aW9uLmpzIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gaW1wb3J0RGVjbGFyYXRpb24oY29udGV4dCkge1xuICB2YXIgYW5jZXN0b3JzID0gY29udGV4dC5nZXRBbmNlc3RvcnMoKVxuICByZXR1cm4gYW5jZXN0b3JzW2FuY2VzdG9ycy5sZW5ndGggLSAxXVxufVxuIl19
|
||||
+73
File diff suppressed because one or more lines are too long
+51
@@ -0,0 +1,51 @@
|
||||
'use strict';
|
||||
|
||||
var _ExportMap = require('../ExportMap');
|
||||
|
||||
var _ExportMap2 = _interopRequireDefault(_ExportMap);
|
||||
|
||||
var _docsUrl = require('../docsUrl');
|
||||
|
||||
var _docsUrl2 = _interopRequireDefault(_docsUrl);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
url: (0, _docsUrl2.default)('default')
|
||||
}
|
||||
},
|
||||
|
||||
create: function (context) {
|
||||
|
||||
function checkDefault(specifierType, node) {
|
||||
|
||||
// poor man's Array.find
|
||||
let defaultSpecifier;
|
||||
node.specifiers.some(n => {
|
||||
if (n.type === specifierType) {
|
||||
defaultSpecifier = n;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!defaultSpecifier) return;
|
||||
var imports = _ExportMap2.default.get(node.source.value, context);
|
||||
if (imports == null) return;
|
||||
|
||||
if (imports.errors.length) {
|
||||
imports.reportErrors(context, node);
|
||||
} else if (imports.get('default') === undefined) {
|
||||
context.report(defaultSpecifier, 'No default export found in module.');
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
'ImportDeclaration': checkDefault.bind(null, 'ImportDefaultSpecifier'),
|
||||
'ExportNamedDeclaration': checkDefault.bind(null, 'ExportDefaultSpecifier')
|
||||
};
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9kZWZhdWx0LmpzIl0sIm5hbWVzIjp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ZXR1cm4gdHJ1ZVxuICAgICAgICB9XG4gICAgICB9KVxuXG4gICAgICBpZiAoIWRlZmF1bHRTcGVjaWZpZXIpIHJldHVyblxuICAgICAgdmFyIGltcG9ydHMgPSBFeHBvcnRzLmdldChub2RlLnNvdXJjZS52YWx1ZSwgY29udGV4dClcbiAgICAgIGlmIChpbXBvcnRzID09IG51bGwpIHJldHVyblxuXG4gICAgICBpZiAoaW1wb3J0cy5lcnJvcnMubGVuZ3RoKSB7XG4gICAgICAgIGltcG9ydHMucmVwb3J0RXJyb3JzKGNvbnRleHQsIG5vZGUpXG4gICAgICB9IGVsc2UgaWYgKGltcG9ydHMuZ2V0KCdkZWZhdWx0JykgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICBjb250ZXh0LnJlcG9ydChkZWZhdWx0U3BlY2lmaWVyLCAnTm8gZGVmYXVsdCBleHBvcnQgZm91bmQgaW4gbW9kdWxlLicpXG4gICAgICB9XG4gICAgfVxuXG4gICAgcmV0dXJuIHtcbiAgICAgICdJbXBvcnREZWNsYXJhdGlvbic6IGNoZWNrRGVmYXVsdC5iaW5kKG51bGwsICdJbXBvcnREZWZhdWx0U3BlY2lmaWVyJyksXG4gICAgICAnRXhwb3J0TmFtZWREZWNsYXJhdGlvbic6IGNoZWNrRGVmYXVsdC5iaW5kKG51bGwsICdFeHBvcnREZWZhdWx0U3BlY2lmaWVyJyksXG4gICAgfVxuICB9LFxufVxuIl19
|
||||
+126
File diff suppressed because one or more lines are too long
+172
File diff suppressed because one or more lines are too long
+49
@@ -0,0 +1,49 @@
|
||||
'use strict';
|
||||
|
||||
var _docsUrl = require('../docsUrl');
|
||||
|
||||
var _docsUrl2 = _interopRequireDefault(_docsUrl);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function isNonExportStatement(_ref) {
|
||||
let type = _ref.type;
|
||||
|
||||
return type !== 'ExportDefaultDeclaration' && type !== 'ExportNamedDeclaration' && type !== 'ExportAllDeclaration';
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
url: (0, _docsUrl2.default)('exports-last')
|
||||
}
|
||||
},
|
||||
|
||||
create: function (context) {
|
||||
return {
|
||||
Program: function (_ref2) {
|
||||
let body = _ref2.body;
|
||||
|
||||
const lastNonExportStatementIndex = body.reduce(function findLastIndex(acc, item, index) {
|
||||
if (isNonExportStatement(item)) {
|
||||
return index;
|
||||
}
|
||||
return acc;
|
||||
}, -1);
|
||||
|
||||
if (lastNonExportStatementIndex !== -1) {
|
||||
body.slice(0, lastNonExportStatementIndex).forEach(function checkNonExport(node) {
|
||||
if (!isNonExportStatement(node)) {
|
||||
context.report({
|
||||
node,
|
||||
message: 'Export statements should appear at the end of the file'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9leHBvcnRzLWxhc3QuanMiXSwibmFtZXMiOlsiaXNOb25FeHBvcnRTdGF0ZW1lbnQiLCJ0eXBlIiwibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJkb2NzIiwidXJsIiwiY3JlYXRlIiwiY29udGV4dCIsIlByb2dyYW0iLCJib2R5IiwibGFzdE5vbkV4cG9ydFN0YXRlbWVudEluZGV4IiwicmVkdWNlIiwiZmluZExhc3RJbmRleCIsImFjYyIsIml0ZW0iLCJpbmRleCIsInNsaWNlIiwiZm9yRWFjaCIsImNoZWNrTm9uRXhwb3J0Iiwibm9kZSIsInJlcG9ydCIsIm1lc3NhZ2UiXSwibWFwcGluZ3MiOiI7O0FBQUE7Ozs7OztBQUVBLFNBQVNBLG9CQUFULE9BQXdDO0FBQUEsTUFBUkMsSUFBUSxRQUFSQSxJQUFROztBQUN0QyxTQUFPQSxTQUFTLDBCQUFULElB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C5yZXBvcnQoe1xuICAgICAgICAgICAgICAgIG5vZGUsXG4gICAgICAgICAgICAgICAgbWVzc2FnZTogJ0V4cG9ydCBzdGF0ZW1lbnRzIHNob3VsZCBhcHBlYXIgYXQgdGhlIGVuZCBvZiB0aGUgZmlsZScsXG4gICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICB9XG4gICAgICAgICAgfSlcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICB9XG4gIH0sXG59XG4iXX0=
|
||||
+170
File diff suppressed because one or more lines are too long
+124
File diff suppressed because one or more lines are too long
+110
File diff suppressed because one or more lines are too long
+19
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
var _docsUrl = require('../docsUrl');
|
||||
|
||||
var _docsUrl2 = _interopRequireDefault(_docsUrl);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const first = require('./first');
|
||||
|
||||
const newMeta = Object.assign({}, first.meta, {
|
||||
deprecated: true,
|
||||
docs: {
|
||||
url: (0, _docsUrl2.default)('imports-first', '7b25c1cb95ee18acc1531002fd343e1e6031f9ed')
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = Object.assign({}, first, { meta: newMeta });
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9pbXBvcnRzLWZpcnN0LmpzIl0sIm5hbWVzIjpbImZpcnN0IiwicmVxdWlyZSIsIm5ld01ldGEiLCJPYmplY3QiLCJhc3NpZ24iLCJtZXRhIiwiZGVwcmVjYXRlZCIsImRvY3MiLCJ1cmwiLCJtb2R1bGUiLCJleHBvcnRzIl0sIm1hcHBpbmdzIjoiOztBQUFBOzs7Ozs7QUFFQSxNQUFNQSxRQUFRQyxRQUFRLFNBQVIsQ0FBZDs7QUFFQSxNQUFNQyxVQUFVQyxPQUFPQyxNQUFQLENBQWMsRUFBZCxFQUFrQkosTUFBTUssSUFBeEIsRUFBOEI7QUFDNUNDLGNBQVksSUFEZ0M7QUFFNUNDLFFBQU07QUFDSkMsU0FBSyx1QkFBUSxlQUFSLEVBQXlCLDBDQUF6QjtBQUREO0FBRnNDLENBQTlCLENBQWhCOztBQU9BQyxPQUFPQyxPQUFQLEdBQWlCUCxPQUFPQyxNQUFQLENBQWMsRUFBZCxFQUFrQkosS0FBbEIsRUFBeUIsRUFBRUssTUFBTUgsT0FBUixFQUF6QixDQUFqQiIsImZpbGUiOiJpbXBvcnRzLWZpcnN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IGRvY3NVcmwgZnJvbSAnLi4vZG9jc1VybCdcblxuY29uc3QgZmlyc3QgPSByZXF1aXJlKCcuL2ZpcnN0JylcblxuY29uc3QgbmV3TWV0YSA9IE9iamVjdC5hc3NpZ24oe30sIGZpcnN0Lm1ldGEsIHtcbiAgZGVwcmVjYXRlZDogdHJ1ZSxcbiAgZG9jczoge1xuICAgIHVybDogZG9jc1VybCgnaW1wb3J0cy1maXJzdCcsICc3YjI1YzFjYjk1ZWUxOGFjYzE1MzEwMDJmZDM0M2UxZTYwMzFmOWVkJyksXG4gIH0sXG59KVxuXG5tb2R1bGUuZXhwb3J0cyA9IE9iamVjdC5hc3NpZ24oe30sIGZpcnN0LCB7IG1ldGE6IG5ld01ldGEgfSlcbiJdfQ==
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
'use strict';
|
||||
|
||||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
||||
|
||||
var _staticRequire = require('../core/staticRequire');
|
||||
|
||||
var _staticRequire2 = _interopRequireDefault(_staticRequire);
|
||||
|
||||
var _docsUrl = require('../docsUrl');
|
||||
|
||||
var _docsUrl2 = _interopRequireDefault(_docsUrl);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const DEFAULT_MAX = 10;
|
||||
|
||||
const countDependencies = (dependencies, lastNode, context) => {
|
||||
var _ref = context.options[0] || { max: DEFAULT_MAX };
|
||||
|
||||
const max = _ref.max;
|
||||
|
||||
|
||||
if (dependencies.size > max) {
|
||||
context.report(lastNode, `Maximum number of dependencies (${max}) exceeded.`);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
url: (0, _docsUrl2.default)('max-dependencies')
|
||||
},
|
||||
|
||||
schema: [{
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'max': { 'type': 'number' }
|
||||
},
|
||||
'additionalProperties': false
|
||||
}]
|
||||
},
|
||||
|
||||
create: context => {
|
||||
const dependencies = new Set(); // keep track of dependencies
|
||||
let lastNode; // keep track of the last node to report on
|
||||
|
||||
return {
|
||||
ImportDeclaration(node) {
|
||||
dependencies.add(node.source.value);
|
||||
lastNode = node.source;
|
||||
},
|
||||
|
||||
CallExpression(node) {
|
||||
if ((0, _staticRequire2.default)(node)) {
|
||||
var _node$arguments = _slicedToArray(node.arguments, 1);
|
||||
|
||||
const requirePath = _node$arguments[0];
|
||||
|
||||
dependencies.add(requirePath.value);
|
||||
lastNode = node;
|
||||
}
|
||||
},
|
||||
|
||||
'Program:exit': function () {
|
||||
countDependencies(dependencies, lastNode, context);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3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zU3RhdGljUmVxdWlyZShub2RlKSkge1xuICAgICAgICAgIGNvbnN0IFsgcmVxdWlyZVBhdGggXSA9IG5vZGUuYXJndW1lbnRzXG4gICAgICAgICAgZGVwZW5kZW5jaWVzLmFkZChyZXF1aXJlUGF0aC52YWx1ZSlcbiAgICAgICAgICBsYXN0Tm9kZSA9IG5vZGVcbiAgICAgICAgfVxuICAgICAgfSxcblxuICAgICAgJ1Byb2dyYW06ZXhpdCc6IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgY291bnREZXBlbmRlbmNpZXMoZGVwZW5kZW5jaWVzLCBsYXN0Tm9kZSwgY29udGV4dClcbiAgICAgIH0sXG4gICAgfVxuICB9LFxufVxuIl19
|
||||
+75
File diff suppressed because one or more lines are too long
+223
File diff suppressed because one or more lines are too long
+170
File diff suppressed because one or more lines are too long
+35
@@ -0,0 +1,35 @@
|
||||
'use strict';
|
||||
|
||||
var _moduleVisitor = require('eslint-module-utils/moduleVisitor');
|
||||
|
||||
var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor);
|
||||
|
||||
var _importType = require('../core/importType');
|
||||
|
||||
var _docsUrl = require('../docsUrl');
|
||||
|
||||
var _docsUrl2 = _interopRequireDefault(_docsUrl);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
url: (0, _docsUrl2.default)('no-absolute-path')
|
||||
},
|
||||
schema: [(0, _moduleVisitor.makeOptionsSchema)()]
|
||||
},
|
||||
|
||||
create: function (context) {
|
||||
function reportIfAbsolute(source) {
|
||||
if ((0, _importType.isAbsolute)(source.value)) {
|
||||
context.report(source, 'Do not import modules using an absolute path');
|
||||
}
|
||||
}
|
||||
|
||||
const options = Object.assign({ esmodule: true, commonjs: true }, context.options[0]);
|
||||
return (0, _moduleVisitor2.default)(reportIfAbsolute, options);
|
||||
}
|
||||
};
|
||||
//# sourceMapp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MiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgbW9kdWxlVmlzaXRvciwgeyBtYWtlT3B0aW9uc1NjaGVtYSB9IGZyb20gJ2VzbGludC1tb2R1bGUtdXRpbHMvbW9kdWxlVmlzaXRvcidcbmltcG9ydCB7IGlzQWJzb2x1dGUgfSBmcm9tICcuLi9jb3JlL2ltcG9ydFR5cGUnXG5pbXBvcnQgZG9jc1VybCBmcm9tICcuLi9kb2NzVXJsJ1xuXG5tb2R1bGUuZXhwb3J0cyA9IHtcbiAgbWV0YToge1xuICAgIHR5cGU6ICdzdWdnZXN0aW9uJyxcbiAgICBkb2NzOiB7XG4gICAgICB1cmw6IGRvY3NVcmwoJ25vLWFic29sdXRlLXBhdGgnKSxcbiAgICB9LFxuICAgIHNjaGVtYTogWyBtYWtlT3B0aW9uc1NjaGVtYSgpIF0sXG4gIH0sXG5cbiAgY3JlYXRlOiBmdW5jdGlvbiAoY29udGV4dCkge1xuICAgIGZ1bmN0aW9uIHJlcG9ydElmQWJzb2x1dGUoc291cmNlKSB7XG4gICAgICBpZiAoaXNBYnNvbHV0ZShzb3VyY2UudmFsdWUpKSB7XG4gICAgICAgIGNvbnRleHQucmVwb3J0KHNvdXJjZSwgJ0RvIG5vdCBpbXBvcnQgbW9kdWxlcyB1c2luZyBhbiBhYnNvbHV0ZSBwYXRoJylcbiAgICAgIH1cbiAgICB9XG5cbiAgICBjb25zdCBvcHRpb25zID0gT2JqZWN0LmFzc2lnbih7IGVzbW9kdWxlOiB0cnVlLCBjb21tb25qczogdHJ1ZSB9LCBjb250ZXh0Lm9wdGlvbnNbMF0pXG4gICAgcmV0dXJuIG1vZHVsZVZpc2l0b3IocmVwb3J0SWZBYnNvbHV0ZSwgb3B0aW9ucylcbiAgfSxcbn1cbiJdfQ==
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
'use strict';
|
||||
|
||||
var _docsUrl = require('../docsUrl');
|
||||
|
||||
var _docsUrl2 = _interopRequireDefault(_docsUrl);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
url: (0, _docsUrl2.default)('no-amd')
|
||||
}
|
||||
},
|
||||
|
||||
create: function (context) {
|
||||
return {
|
||||
'CallExpression': function (node) {
|
||||
if (context.getScope().type !== 'module') return;
|
||||
|
||||
if (node.callee.type !== 'Identifier') return;
|
||||
if (node.callee.name !== 'require' && node.callee.name !== 'define') return;
|
||||
|
||||
// todo: capture define((require, module, exports) => {}) form?
|
||||
if (node.arguments.length !== 2) return;
|
||||
|
||||
const modules = node.arguments[0];
|
||||
if (modules.type !== 'ArrayExpression') return;
|
||||
|
||||
// todo: check second arg type? (identifier or callback)
|
||||
|
||||
context.report(node, `Expected imports instead of AMD ${node.callee.name}().`);
|
||||
}
|
||||
};
|
||||
}
|
||||
}; /**
|
||||
* @fileoverview Rule to prefer imports to AMD
|
||||
* @author Jamund Ferguson
|
||||
*/
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1hbWQuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsInVybCIsImNyZWF0ZSIsImNvbnRleHQiLCJub2RlIiwiZ2V0U2NvcGUiLCJjYWxsZWUiLCJuYW1lIiwiYXJndW1lbnRzIiwibGVuZ3RoIiwibW9kdWxlcyIsInJlcG9ydCJdLCJtYXBwaW5ncyI6Ijs7QUFLQTs7Ozs7O0FBRUE7QUFDQTtBQUNBOztBQUVBQSxPQUFPQyxPQUFQLEdBQWlCO0FBQ2ZDLFFBQU07QUFDSkMsVUFBTSxZQURGO0FBRUpDLFVBQU07QUFDSkM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aylcblxuICAgICAgICBjb250ZXh0LnJlcG9ydChub2RlLCBgRXhwZWN0ZWQgaW1wb3J0cyBpbnN0ZWFkIG9mIEFNRCAke25vZGUuY2FsbGVlLm5hbWV9KCkuYClcbiAgICAgIH0sXG4gICAgfVxuXG4gIH0sXG59XG4iXX0=
|
||||
+108
File diff suppressed because one or more lines are too long
+111
File diff suppressed because one or more lines are too long
+105
File diff suppressed because one or more lines are too long
+38
@@ -0,0 +1,38 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {}
|
||||
},
|
||||
|
||||
create(context) {
|
||||
// ignore non-modules
|
||||
if (context.parserOptions.sourceType !== 'module') {
|
||||
return {};
|
||||
}
|
||||
|
||||
const preferNamed = 'Prefer named exports.';
|
||||
const noAliasDefault = (_ref) => {
|
||||
let local = _ref.local;
|
||||
return `Do not alias \`${local.name}\` as \`default\`. Just export ` + `\`${local.name}\` itself instead.`;
|
||||
};
|
||||
|
||||
return {
|
||||
ExportDefaultDeclaration(node) {
|
||||
context.report({ node, message: preferNamed });
|
||||
},
|
||||
|
||||
ExportNamedDeclaration(node) {
|
||||
node.specifiers.forEach(specifier => {
|
||||
if (specifier.type === 'ExportDefaultSpecifier' && specifier.exported.name === 'default') {
|
||||
context.report({ node, message: preferNamed });
|
||||
} else if (specifier.type === 'ExportSpecifier' && specifier.exported.name === 'default') {
|
||||
context.report({ node, message: noAliasDefault(specifier) });
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1kZWZhdWx0LWV4cG9ydC5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIiwibWV0YSIsInR5cGUiLCJkb2NzIiwiY3JlYXRlIiwiY29udGV4dCIsInBhcnNlck9wdGlvbnMiLCJz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XBvcnQoe25vZGUsIG1lc3NhZ2U6IHByZWZlck5hbWVkfSlcbiAgICAgIH0sXG5cbiAgICAgIEV4cG9ydE5hbWVkRGVjbGFyYXRpb24obm9kZSkge1xuICAgICAgICBub2RlLnNwZWNpZmllcnMuZm9yRWFjaChzcGVjaWZpZXIgPT4ge1xuICAgICAgICAgIGlmIChzcGVjaWZpZXIudHlwZSA9PT0gJ0V4cG9ydERlZmF1bHRTcGVjaWZpZXInICYmXG4gICAgICAgICAgICAgIHNwZWNpZmllci5leHBvcnRlZC5uYW1lID09PSAnZGVmYXVsdCcpIHtcbiAgICAgICAgICAgIGNvbnRleHQucmVwb3J0KHtub2RlLCBtZXNzYWdlOiBwcmVmZXJOYW1lZH0pXG4gICAgICAgICAgfSBlbHNlIGlmIChzcGVjaWZpZXIudHlwZSA9PT0gJ0V4cG9ydFNwZWNpZmllcicgJiZcbiAgICAgICAgICAgICAgc3BlY2lmaWVyLmV4cG9ydGVkLm5hbWUgPT09ICdkZWZhdWx0Jykge1xuICAgICAgICAgICAgY29udGV4dC5yZXBvcnQoe25vZGUsIG1lc3NhZ2U6IG5vQWxpYXNEZWZhdWx0KHNwZWNpZmllcil9KVxuICAgICAgICAgIH1cbiAgICAgICAgfSlcbiAgICAgIH0sXG4gICAgfVxuICB9LFxufVxuIl19
|
||||
+156
File diff suppressed because one or more lines are too long
+262
File diff suppressed because one or more lines are too long
+38
@@ -0,0 +1,38 @@
|
||||
'use strict';
|
||||
|
||||
var _docsUrl = require('../docsUrl');
|
||||
|
||||
var _docsUrl2 = _interopRequireDefault(_docsUrl);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function isRequire(node) {
|
||||
return node && node.callee && node.callee.type === 'Identifier' && node.callee.name === 'require' && node.arguments.length >= 1;
|
||||
}
|
||||
|
||||
function isStaticValue(arg) {
|
||||
return arg.type === 'Literal' || arg.type === 'TemplateLiteral' && arg.expressions.length === 0;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
url: (0, _docsUrl2.default)('no-dynamic-require')
|
||||
}
|
||||
},
|
||||
|
||||
create: function (context) {
|
||||
return {
|
||||
CallExpression(node) {
|
||||
if (isRequire(node) && !isStaticValue(node.arguments[0])) {
|
||||
context.report({
|
||||
node,
|
||||
message: 'Calls to require() should use string literals'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1keW5hbWljLXJlcXVpcmUuanMiXSwibmFtZXMiOlsiaXNSZXF1aXJlIiwibm9kZSIsImNhbGxlZSIsInR5cGUiLCJuYW1lIiwiYXJndW1lbnRzIiwibGVuZ3RoIiwiaXNTdGF0aWNWYWx1ZSIsImFyZyIsImV4cHJlc3Npb25zIiwibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJkb2NzIiwidXJsIiwiY3JlYXRlIiwiY29udGV4dCIsIkNhbGxFeHByZXNzaW9uIiwicmVwb3J0IiwibWVzc2FnZSJdLCJtYXBwaW5ncyI6Ijs7QUFBQTs7Ozs7O0FBRUEsU0FBU0EsU0FBVCxDQUFtQkMsSUFBbkIsRUFBeUI7QUFDdkIsU0FBT0EsUUFDTEEsS0FBS0MsTUFEQSxJQUVMRCxLQUFLQyxNQUFMLENBQVlDLElBQVosS0FBcUIsWUFGaEIsSUFHTEYsS0FBS0MsTUFBTCxDQUFZRSxJQUFaLEtBQXFCLFNBSGhCLElBSUxILEtBQUtJLFNBQUwsQ0FBZUMsTUFBZixJQUF5QixDQUozQjtBQUtEOztBQUVELFNBQVNDLGFBQVQsQ0FBdUJDLEdBQXZCLEVBQTRCO0FBQzFCLFNBQU9BLElBQUlMLElBQUosS0FBYSxTQUFiLElBQ0pLLElBQUlMLElBQUosS0FBYSxpQk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W9kdWxlLmV4cG9ydHMgPSB7XG4gIG1ldGE6IHtcbiAgICB0eXBlOiAnc3VnZ2VzdGlvbicsXG4gICAgZG9jczoge1xuICAgICAgdXJsOiBkb2NzVXJsKCduby1keW5hbWljLXJlcXVpcmUnKSxcbiAgICB9LFxuICB9LFxuXG4gIGNyZWF0ZTogZnVuY3Rpb24gKGNvbnRleHQpIHtcbiAgICByZXR1cm4ge1xuICAgICAgQ2FsbEV4cHJlc3Npb24obm9kZSkge1xuICAgICAgICBpZiAoaXNSZXF1aXJlKG5vZGUpICYmICFpc1N0YXRpY1ZhbHVlKG5vZGUuYXJndW1lbnRzWzBdKSkge1xuICAgICAgICAgIGNvbnRleHQucmVwb3J0KHtcbiAgICAgICAgICAgIG5vZGUsXG4gICAgICAgICAgICBtZXNzYWdlOiAnQ2FsbHMgdG8gcmVxdWlyZSgpIHNob3VsZCB1c2Ugc3RyaW5nIGxpdGVyYWxzJyxcbiAgICAgICAgICB9KVxuICAgICAgICB9XG4gICAgICB9LFxuICAgIH1cbiAgfSxcbn1cbiJdfQ==
|
||||
+206
File diff suppressed because one or more lines are too long
+119
File diff suppressed because one or more lines are too long
+66
@@ -0,0 +1,66 @@
|
||||
'use strict';
|
||||
|
||||
var _docsUrl = require('../docsUrl');
|
||||
|
||||
var _docsUrl2 = _interopRequireDefault(_docsUrl);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
url: (0, _docsUrl2.default)('no-mutable-exports')
|
||||
}
|
||||
},
|
||||
|
||||
create: function (context) {
|
||||
function checkDeclaration(node) {
|
||||
const kind = node.kind;
|
||||
|
||||
if (kind === 'var' || kind === 'let') {
|
||||
context.report(node, `Exporting mutable '${kind}' binding, use 'const' instead.`);
|
||||
}
|
||||
}
|
||||
|
||||
function checkDeclarationsInScope(_ref, name) {
|
||||
let variables = _ref.variables;
|
||||
|
||||
for (let variable of variables) {
|
||||
if (variable.name === name) {
|
||||
for (let def of variable.defs) {
|
||||
if (def.type === 'Variable' && def.parent) {
|
||||
checkDeclaration(def.parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handleExportDefault(node) {
|
||||
const scope = context.getScope();
|
||||
|
||||
if (node.declaration.name) {
|
||||
checkDeclarationsInScope(scope, node.declaration.name);
|
||||
}
|
||||
}
|
||||
|
||||
function handleExportNamed(node) {
|
||||
const scope = context.getScope();
|
||||
|
||||
if (node.declaration) {
|
||||
checkDeclaration(node.declaration);
|
||||
} else if (!node.source) {
|
||||
for (let specifier of node.specifiers) {
|
||||
checkDeclarationsInScope(scope, specifier.local.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
'ExportDefaultDeclaration': handleExportDefault,
|
||||
'ExportNamedDeclaration': handleExportNamed
|
||||
};
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1tdXRhYmxlLWV4cG9ydHMuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsInVybCIsImNyZWF0ZSIsImNvbnRleHQiLCJjaGVja0RlY2xhcmF0aW9uIiwibm9kZSIsImtpbmQiLCJyZXBvcnQiLCJjaGVja0RlY2xhcmF0aW9uc0luU2NvcGUiLCJuYW1lIiwidmFyaWFibGVzIiwidmFyaWFibGUiLCJkZWYiLCJkZWZzIiwicGFyZW50IiwiaGFuZGxlRXhwb3J0RGVmYXVsdCIsInNjb3BlIiwiZ2V0U2NvcGUiLCJkZWNsYXJhdGlvbiIsImhhbmRsZUV4cG9ydE5hbWVkIiwic291cmNlIiwic3BlY2lmaWVyIiwic3BlY2lmaWVycyIsImxvY2FsIl0sIm1hcHBpbmdzIjoiOztBQUFBO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llcnMpIHtcbiAgICAgICAgICBjaGVja0RlY2xhcmF0aW9uc0luU2NvcGUoc2NvcGUsIHNwZWNpZmllci5sb2NhbC5uYW1lKVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuXG4gICAgcmV0dXJuIHtcbiAgICAgICdFeHBvcnREZWZhdWx0RGVjbGFyYXRpb24nOiBoYW5kbGVFeHBvcnREZWZhdWx0LFxuICAgICAgJ0V4cG9ydE5hbWVkRGVjbGFyYXRpb24nOiBoYW5kbGVFeHBvcnROYW1lZCxcbiAgICB9XG4gIH0sXG59XG4iXX0=
|
||||
+109
File diff suppressed because one or more lines are too long
+51
@@ -0,0 +1,51 @@
|
||||
'use strict';
|
||||
|
||||
var _ExportMap = require('../ExportMap');
|
||||
|
||||
var _ExportMap2 = _interopRequireDefault(_ExportMap);
|
||||
|
||||
var _importDeclaration = require('../importDeclaration');
|
||||
|
||||
var _importDeclaration2 = _interopRequireDefault(_importDeclaration);
|
||||
|
||||
var _docsUrl = require('../docsUrl');
|
||||
|
||||
var _docsUrl2 = _interopRequireDefault(_docsUrl);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
url: (0, _docsUrl2.default)('no-named-as-default')
|
||||
}
|
||||
},
|
||||
|
||||
create: function (context) {
|
||||
function checkDefault(nameKey, defaultSpecifier) {
|
||||
// #566: default is a valid specifier
|
||||
if (defaultSpecifier[nameKey].name === 'default') return;
|
||||
|
||||
var declaration = (0, _importDeclaration2.default)(context);
|
||||
|
||||
var imports = _ExportMap2.default.get(declaration.source.value, context);
|
||||
if (imports == null) return;
|
||||
|
||||
if (imports.errors.length) {
|
||||
imports.reportErrors(context, declaration);
|
||||
return;
|
||||
}
|
||||
|
||||
if (imports.has('default') && imports.has(defaultSpecifier[nameKey].name)) {
|
||||
|
||||
context.report(defaultSpecifier, 'Using exported name \'' + defaultSpecifier[nameKey].name + '\' as identifier for default export.');
|
||||
}
|
||||
}
|
||||
return {
|
||||
'ImportDefaultSpecifier': checkDefault.bind(null, 'local'),
|
||||
'ExportDefaultSpecifier': checkDefault.bind(null, 'exported')
|
||||
};
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1uYW1lZC1hcy1kZWZhdWx0LmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJ1cmwiLCJjcmVhdGUiLCJjb250ZXh0IiwiY2hlY2tEZWZhdWx0IiwibmFtZUtleSIsImRlZmF1bHRTcGVjaWZpZXIiLCJuYW1lIiwiZGVjbGFyYXRpb24iLCJpbXBvcnRzIiwiRXhwb3J0cyIsImdldCIsInNvdXJjZSIsInZhbHVlIiwiZXJyb3JzIiwibGVuZ3RoIiwicmVwb3J0RXJyb3JzIiwiaGFzIiwicmVwb3J0IiwiYmluZCJdLCJtYXBwaW5ncyI6Ijs7QUFBQTs7OztBQUNBOzs7O0FBQ0E7Ozs7OztBQUVBQSxPQUFPQyxPQUFQLEdBQWlCO0FBQ2ZDLFFBQU07QUFDSkMsVUFBTSxTQURGO0FBRUpDLFVBQU07QUFDSkMsV0FBSyx1QkFBUSxxQkFBUjtBQUREO0FBRkYsR0FEUzs7QUFRZkMsVUFBUSxVQUFVQyxPQUFWLEVBQW1CO0FBQ3pCLGFBQVNDLFlBQVQsQ0FBc0JDLE9BQXRCLEVBQStCQyxnQkFBL0IsRUFBaUQ7QUFDL0M7QUFDQSxVQUFJQSxpQkFBaUJELE9BQWpCLEVBQTBCRSxJQUExQixLQUFtQyxTQUF2QyxFQUFrRDs7QUFFbEQsVUFBSUMsY0FBYyxpQ0FBa0JMLE9BQWxCLENBQWxCOztBQUVBLFVBQUlNLFVBQVVDLG9CQUFRQyxHQUFSLEN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WwnKSxcbiAgICAgICdFeHBvcnREZWZhdWx0U3BlY2lmaWVyJzogY2hlY2tEZWZhdWx0LmJpbmQobnVsbCwgJ2V4cG9ydGVkJyksXG4gICAgfVxuICB9LFxufVxuIl19
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
|
||||
var _docsUrl = require('../docsUrl');
|
||||
|
||||
var _docsUrl2 = _interopRequireDefault(_docsUrl);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
url: (0, _docsUrl2.default)('no-named-default')
|
||||
}
|
||||
},
|
||||
|
||||
create: function (context) {
|
||||
return {
|
||||
'ImportDeclaration': function (node) {
|
||||
node.specifiers.forEach(function (im) {
|
||||
if (im.type === 'ImportSpecifier' && im.imported.name === 'default') {
|
||||
context.report({
|
||||
node: im.local,
|
||||
message: `Use default import syntax to import '${im.local.name}'.` });
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1uYW1lZC1kZWZhdWx0LmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJ1cmwiLCJjcmVhdGUiLCJjb250ZXh0Iiwibm9kZSIsInNwZWNpZmllcnMiLCJmb3JFYWNoIiwiaW0iLCJpbXBvcnRlZCIsIm5hbWUiLCJyZXBvcnQiLCJsb2NhbCIsIm1lc3NhZ2UiXSwibWFwcGluZ3MiOiI7O0FBQUE7Ozs7OztBQUVBQSxPQUFPQyxPQUFQLEdBQWlCO0FBQ2ZDLFFBQU07QUFDSkMsVUFBTSxZQURGO0FBRUpDLFVBQU07QUFDSkMsV0FBSyx1QkFBUSxrQkFBUj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gICAgICAgICAgIGNvbnRleHQucmVwb3J0KHtcbiAgICAgICAgICAgICAgbm9kZTogaW0ubG9jYWwsXG4gICAgICAgICAgICAgIG1lc3NhZ2U6IGBVc2UgZGVmYXVsdCBpbXBvcnQgc3ludGF4IHRvIGltcG9ydCAnJHtpbS5sb2NhbC5uYW1lfScuYCB9KVxuICAgICAgICAgIH1cbiAgICAgICAgfSlcbiAgICAgIH0sXG4gICAgfVxuICB9LFxufVxuIl19
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
'use strict';
|
||||
|
||||
var _docsUrl = require('../docsUrl');
|
||||
|
||||
var _docsUrl2 = _interopRequireDefault(_docsUrl);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: { url: (0, _docsUrl2.default)('no-named-export') }
|
||||
},
|
||||
|
||||
create(context) {
|
||||
// ignore non-modules
|
||||
if (context.parserOptions.sourceType !== 'module') {
|
||||
return {};
|
||||
}
|
||||
|
||||
const message = 'Named exports are not allowed.';
|
||||
|
||||
return {
|
||||
ExportAllDeclaration(node) {
|
||||
context.report({ node, message });
|
||||
},
|
||||
|
||||
ExportNamedDeclaration(node) {
|
||||
if (node.specifiers.length === 0) {
|
||||
return context.report({ node, message });
|
||||
}
|
||||
|
||||
const someNamed = node.specifiers.some(specifier => specifier.exported.name !== 'default');
|
||||
if (someNamed) {
|
||||
context.report({ node, message });
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1uYW1lZC1leHBvcnQuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsInVybCIsImNyZWF0ZSIsImNvbnRleHQiLCJwYXJzZXJP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b21lTmFtZWQpIHtcbiAgICAgICAgICBjb250ZXh0LnJlcG9ydCh7bm9kZSwgbWVzc2FnZX0pXG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgfVxuICB9LFxufVxuIl19
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
var _docsUrl = require('../docsUrl');
|
||||
|
||||
var _docsUrl2 = _interopRequireDefault(_docsUrl);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
url: (0, _docsUrl2.default)('no-namespace')
|
||||
}
|
||||
},
|
||||
|
||||
create: function (context) {
|
||||
return {
|
||||
'ImportNamespaceSpecifier': function (node) {
|
||||
context.report(node, `Unexpected namespace import.`);
|
||||
}
|
||||
};
|
||||
}
|
||||
}; /**
|
||||
* @fileoverview Rule to disallow namespace import
|
||||
* @author Radek Benkel
|
||||
*/
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1uYW1lc3BhY2UuanMiXSwibmFtZXMiOlsibW9kdWxlIiwiZXhwb3J0cyIsIm1ldGEiLCJ0eXBlIiwiZG9jcyIsInVybCIsImNyZWF0ZSIsImNvbnRleHQiLCJub2RlIiwicmVwb3J0Il0sIm1hcHBpbmdzIjoiOztBQUtBOzs7Ozs7QUFFQTtBQUNBO0FBQ0E7OztBQUdBQSxPQUFPQyxPQUFQLEdBQWlCO0FBQ2ZDLFFBQU07QUFDSkMsVUFBTSxZQURGO0FBRUpDLFVBQU07QUFDSkMsV0FBSyx1QkFBUSxjQUFSO0FBREQ7QUFGRixHQURTOztBQVFmQyxVQUFRLFVBQVVDLE9BQVYsRUFBbU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 -0,0 +1,47 @@
|
||||
'use strict';
|
||||
|
||||
var _importType = require('../core/importType');
|
||||
|
||||
var _importType2 = _interopRequireDefault(_importType);
|
||||
|
||||
var _staticRequire = require('../core/staticRequire');
|
||||
|
||||
var _staticRequire2 = _interopRequireDefault(_staticRequire);
|
||||
|
||||
var _docsUrl = require('../docsUrl');
|
||||
|
||||
var _docsUrl2 = _interopRequireDefault(_docsUrl);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function reportIfMissing(context, node, allowed, name) {
|
||||
if (allowed.indexOf(name) === -1 && (0, _importType2.default)(name, context) === 'builtin') {
|
||||
context.report(node, 'Do not import Node.js builtin module "' + name + '"');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
url: (0, _docsUrl2.default)('no-nodejs-modules')
|
||||
}
|
||||
},
|
||||
|
||||
create: function (context) {
|
||||
const options = context.options[0] || {};
|
||||
const allowed = options.allow || [];
|
||||
|
||||
return {
|
||||
ImportDeclaration: function handleImports(node) {
|
||||
reportIfMissing(context, node, allowed, node.source.value);
|
||||
},
|
||||
CallExpression: function handleRequires(node) {
|
||||
if ((0, _staticRequire2.default)(node)) {
|
||||
reportIfMissing(context, node, allowed, node.arguments[0].value);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1ub2RlanMtbW9kdWxlcy5qcyJdLCJuYW1lcyI6WyJyZXBvcnRJZk1pc3NpbmciLCJjb250ZXh0Iiwibm9kZSIsImFsbG93ZWQiLCJuYW1lIiwiaW5kZXhPZiIsInJlcG9ydCIsIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJ1cmwiLCJjcmVhdGUiLCJv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4gICAgY29uc3QgYWxsb3dlZCA9IG9wdGlvbnMuYWxsb3cgfHwgW11cblxuICAgIHJldHVybiB7XG4gICAgICBJbXBvcnREZWNsYXJhdGlvbjogZnVuY3Rpb24gaGFuZGxlSW1wb3J0cyhub2RlKSB7XG4gICAgICAgIHJlcG9ydElmTWlzc2luZyhjb250ZXh0LCBub2RlLCBhbGxvd2VkLCBub2RlLnNvdXJjZS52YWx1ZSlcbiAgICAgIH0sXG4gICAgICBDYWxsRXhwcmVzc2lvbjogZnVuY3Rpb24gaGFuZGxlUmVxdWlyZXMobm9kZSkge1xuICAgICAgICBpZiAoaXNTdGF0aWNSZXF1aXJlKG5vZGUpKSB7XG4gICAgICAgICAgcmVwb3J0SWZNaXNzaW5nKGNvbnRleHQsIG5vZGUsIGFsbG93ZWQsIG5vZGUuYXJndW1lbnRzWzBdLnZhbHVlKVxuICAgICAgICB9XG4gICAgICB9LFxuICAgIH1cbiAgfSxcbn1cbiJdfQ==
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
'use strict';
|
||||
|
||||
var _moduleVisitor = require('eslint-module-utils/moduleVisitor');
|
||||
|
||||
var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor);
|
||||
|
||||
var _docsUrl = require('../docsUrl');
|
||||
|
||||
var _docsUrl2 = _interopRequireDefault(_docsUrl);
|
||||
|
||||
var _path = require('path');
|
||||
|
||||
var _resolve = require('eslint-module-utils/resolve');
|
||||
|
||||
var _resolve2 = _interopRequireDefault(_resolve);
|
||||
|
||||
var _importType = require('../core/importType');
|
||||
|
||||
var _importType2 = _interopRequireDefault(_importType);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
url: (0, _docsUrl2.default)('no-relative-parent-imports')
|
||||
},
|
||||
schema: [(0, _moduleVisitor.makeOptionsSchema)()]
|
||||
},
|
||||
|
||||
create: function noRelativePackages(context) {
|
||||
const myPath = context.getFilename();
|
||||
if (myPath === '<text>') return {}; // can't check a non-file
|
||||
|
||||
function checkSourceValue(sourceNode) {
|
||||
const depPath = sourceNode.value;
|
||||
|
||||
if ((0, _importType2.default)(depPath, context) === 'external') {
|
||||
// ignore packages
|
||||
return;
|
||||
}
|
||||
|
||||
const absDepPath = (0, _resolve2.default)(depPath, context);
|
||||
|
||||
if (!absDepPath) {
|
||||
// unable to resolve path
|
||||
return;
|
||||
}
|
||||
|
||||
const relDepPath = (0, _path.relative)((0, _path.dirname)(myPath), absDepPath);
|
||||
|
||||
if ((0, _importType2.default)(relDepPath, context) === 'parent') {
|
||||
context.report({
|
||||
node: sourceNode,
|
||||
message: 'Relative imports from parent directories are not allowed. ' + `Please either pass what you're importing through at runtime ` + `(dependency injection), move \`${(0, _path.basename)(myPath)}\` to same ` + `directory as \`${depPath}\` or consider making \`${depPath}\` a package.`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return (0, _moduleVisitor2.default)(checkSourceValue, context.options[0]);
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1yZWxhdGl2ZS1wYXJlbnQtaW1wb3J0cy5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIiwibWV0YSIsInR5cGUiLCJkb2NzIiwidXJsIiwic2NoZW1hIiwiY3JlYXRlIiwibm9SZWxhdGl2ZVBhY2thZ2VzIiwiY29udGV4dCIsIm15UGF0aCIsImdldEZpbGVuYW1lIiwiY2hlY2tTb3VyY2VWYWx1ZSIsInNvdXJjZU5vZGUiLCJkZXBQYXRoIiwidmFsdWUiLCJhYnNEZXBQYXRoIiwicmVsRGVwUGF0aCIsInJlcG9ydCIsIm5vZGUiLCJtZXNzYWdlIiwib3B0aW9ucyJdLCJtYXBwaW5ncyI6Ijs7QUFBQTs7OztBQUNBO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2VWYWx1ZSwgY29udGV4dC5vcHRpb25zWzBdKVxuICB9LFxufVxuIl19
|
||||
+102
File diff suppressed because one or more lines are too long
+56
@@ -0,0 +1,56 @@
|
||||
'use strict';
|
||||
|
||||
var _resolve = require('eslint-module-utils/resolve');
|
||||
|
||||
var _resolve2 = _interopRequireDefault(_resolve);
|
||||
|
||||
var _staticRequire = require('../core/staticRequire');
|
||||
|
||||
var _staticRequire2 = _interopRequireDefault(_staticRequire);
|
||||
|
||||
var _docsUrl = require('../docsUrl');
|
||||
|
||||
var _docsUrl2 = _interopRequireDefault(_docsUrl);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function isImportingSelf(context, node, requireName) {
|
||||
const filePath = context.getFilename();
|
||||
|
||||
// If the input is from stdin, this test can't fail
|
||||
if (filePath !== '<text>' && filePath === (0, _resolve2.default)(requireName, context)) {
|
||||
context.report({
|
||||
node,
|
||||
message: 'Module imports itself.'
|
||||
});
|
||||
}
|
||||
} /**
|
||||
* @fileOverview Forbids a module from importing itself
|
||||
* @author Gio d'Amelio
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'Forbid a module from importing itself',
|
||||
recommended: true,
|
||||
url: (0, _docsUrl2.default)('no-self-import')
|
||||
},
|
||||
|
||||
schema: []
|
||||
},
|
||||
create: function (context) {
|
||||
return {
|
||||
ImportDeclaration(node) {
|
||||
isImportingSelf(context, node, node.source.value);
|
||||
},
|
||||
CallExpression(node) {
|
||||
if ((0, _staticRequire2.default)(node)) {
|
||||
isImportingSelf(context, node, node.arguments[0].value);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1zZWxmLWltcG9ydC5qcyJdLCJuYW1lcyI6WyJ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bGUgaW1wb3J0cyBpdHNlbGYuJyxcbiAgICB9KVxuICB9XG59XG5cbm1vZHVsZS5leHBvcnRzID0ge1xuICBtZXRhOiB7XG4gICAgdHlwZTogJ3Byb2JsZW0nLFxuICAgIGRvY3M6IHtcbiAgICAgIGRlc2NyaXB0aW9uOiAnRm9yYmlkIGEgbW9kdWxlIGZyb20gaW1wb3J0aW5nIGl0c2VsZicsXG4gICAgICByZWNvbW1lbmRlZDogdHJ1ZSxcbiAgICAgIHVybDogZG9jc1VybCgnbm8tc2VsZi1pbXBvcnQnKSxcbiAgICB9LFxuXG4gICAgc2NoZW1hOiBbXSxcbiAgfSxcbiAgY3JlYXRlOiBmdW5jdGlvbiAoY29udGV4dCkge1xuICAgIHJldHVybiB7XG4gICAgICBJbXBvcnREZWNsYXJhdGlvbihub2RlKSB7XG4gICAgICAgIGlzSW1wb3J0aW5nU2VsZihjb250ZXh0LCBub2RlLCBub2RlLnNvdXJjZS52YWx1ZSlcbiAgICAgIH0sXG4gICAgICBDYWxsRXhwcmVzc2lvbihub2RlKSB7XG4gICAgICAgIGlmIChpc1N0YXRpY1JlcXVpcmUobm9kZSkpIHtcbiAgICAgICAgICBpc0ltcG9ydGluZ1NlbGYoY29udGV4dCwgbm9kZSwgbm9kZS5hcmd1bWVudHNbMF0udmFsdWUpXG4gICAgICAgIH1cbiAgICAgIH0sXG4gICAgfVxuICB9LFxufVxuIl19
|
||||
+88
File diff suppressed because one or more lines are too long
+58
@@ -0,0 +1,58 @@
|
||||
'use strict';
|
||||
|
||||
var _resolve = require('eslint-module-utils/resolve');
|
||||
|
||||
var _resolve2 = _interopRequireDefault(_resolve);
|
||||
|
||||
var _ModuleCache = require('eslint-module-utils/ModuleCache');
|
||||
|
||||
var _ModuleCache2 = _interopRequireDefault(_ModuleCache);
|
||||
|
||||
var _moduleVisitor = require('eslint-module-utils/moduleVisitor');
|
||||
|
||||
var _moduleVisitor2 = _interopRequireDefault(_moduleVisitor);
|
||||
|
||||
var _docsUrl = require('../docsUrl');
|
||||
|
||||
var _docsUrl2 = _interopRequireDefault(_docsUrl);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* @fileOverview Ensures that an imported path exists, given resolution rules.
|
||||
* @author Ben Mosher
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
url: (0, _docsUrl2.default)('no-unresolved')
|
||||
},
|
||||
|
||||
schema: [(0, _moduleVisitor.makeOptionsSchema)({
|
||||
caseSensitive: { type: 'boolean', default: true }
|
||||
})]
|
||||
},
|
||||
|
||||
create: function (context) {
|
||||
|
||||
function checkSourceValue(source) {
|
||||
const shouldCheckCase = !_resolve.CASE_SENSITIVE_FS && (!context.options[0] || context.options[0].caseSensitive !== false);
|
||||
|
||||
const resolvedPath = (0, _resolve2.default)(source.value, context);
|
||||
|
||||
if (resolvedPath === undefined) {
|
||||
context.report(source, `Unable to resolve path to module '${source.value}'.`);
|
||||
} else if (shouldCheckCase) {
|
||||
const cacheSettings = _ModuleCache2.default.getSettings(context.settings);
|
||||
if (!(0, _resolve.fileExistsWithCaseSync)(resolvedPath, cacheSettings)) {
|
||||
context.report(source, `Casing of ${source.value} does not match the underlying filesystem.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (0, _moduleVisitor2.default)(checkSourceValue, context.options[0]);
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby11bnJlc29sdmVkLmpzIl0sIm5hbWVzIjpbIm1vZHVsZSIsImV4cG9ydHMiLCJtZXRhIiwidHlwZSIsImRvY3MiLCJ1cmwiLCJzY2hlbWEiLCJjYXNlU2Vuc2l0aXZlIiwiZGVmYXVsdCIsImNyZWF0ZSIsImNvbnRleHQiLCJjaGVja1NvdXJjZVZhbHVlI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bmcgZmlsZXN5c3RlbS5gKVxuICAgICAgICB9XG5cbiAgICAgIH1cbiAgICB9XG5cbiAgICByZXR1cm4gbW9kdWxlVmlzaXRvcihjaGVja1NvdXJjZVZhbHVlLCBjb250ZXh0Lm9wdGlvbnNbMF0pXG5cbiAgfSxcbn1cbiJdfQ==
|
||||
+839
File diff suppressed because one or more lines are too long
+151
File diff suppressed because one or more lines are too long
+40
@@ -0,0 +1,40 @@
|
||||
'use strict';
|
||||
|
||||
var _staticRequire = require('../core/staticRequire');
|
||||
|
||||
var _staticRequire2 = _interopRequireDefault(_staticRequire);
|
||||
|
||||
var _docsUrl = require('../docsUrl');
|
||||
|
||||
var _docsUrl2 = _interopRequireDefault(_docsUrl);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function reportIfNonStandard(context, node, name) {
|
||||
if (name.indexOf('!') !== -1) {
|
||||
context.report(node, `Unexpected '!' in '${name}'. ` + 'Do not use import syntax to configure webpack loaders.');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
url: (0, _docsUrl2.default)('no-webpack-loader-syntax')
|
||||
}
|
||||
},
|
||||
|
||||
create: function (context) {
|
||||
return {
|
||||
ImportDeclaration: function handleImports(node) {
|
||||
reportIfNonStandard(context, node, node.source.value);
|
||||
},
|
||||
CallExpression: function handleRequires(node) {
|
||||
if ((0, _staticRequire2.default)(node)) {
|
||||
reportIfNonStandard(context, node, node.arguments[0].value);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby13ZWJwYWNrLWxvYWRlci1zeW50YXguanMiXSwibmFtZXMiOlsicmVwb3J0SWZOb25TdGFuZGFyZCIsImNvbnRleHQiLCJub2RlIiwibmFtZS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G5vZGUpKSB7XG4gICAgICAgICAgcmVwb3J0SWZOb25TdGFuZGFyZChjb250ZXh0LCBub2RlLCBub2RlLmFyZ3VtZW50c1swXS52YWx1ZSlcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICB9XG4gIH0sXG59XG4iXX0=
|
||||
+422
File diff suppressed because one or more lines are too long
+91
File diff suppressed because one or more lines are too long
+42
@@ -0,0 +1,42 @@
|
||||
'use strict';
|
||||
|
||||
var _unambiguous = require('eslint-module-utils/unambiguous');
|
||||
|
||||
var _docsUrl = require('../docsUrl');
|
||||
|
||||
var _docsUrl2 = _interopRequireDefault(_docsUrl);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* @fileOverview Report modules that could parse incorrectly as scripts.
|
||||
* @author Ben Mosher
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
url: (0, _docsUrl2.default)('unambiguous')
|
||||
}
|
||||
},
|
||||
|
||||
create: function (context) {
|
||||
// ignore non-modules
|
||||
if (context.parserOptions.sourceType !== 'module') {
|
||||
return {};
|
||||
}
|
||||
|
||||
return {
|
||||
Program: function (ast) {
|
||||
if (!(0, _unambiguous.isModule)(ast)) {
|
||||
context.report({
|
||||
node: ast,
|
||||
message: 'This module could be parsed as a valid script.'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy91bmFtYmlndW91cy5qcyJdLCJuYW1lcyI6WyJtb2R1bGUiLCJleHBvcnRzIiwibWV0YSIsInR5cGUiLCJkb2NzIiwidXJsIiwiY3JlYXRlIiwiY29udGV4dCIsInBhcnNlck9wdGlvbnMiLCJzb3VyY2VUeXBlIiwiUHJvZ3JhbSIsImFzdCIsInJlcG9yd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KSxcbiAgICB9LFxuICB9LFxuXG4gIGNyZWF0ZTogZnVuY3Rpb24gKGNvbnRleHQpIHtcbiAgICAvLyBpZ25vcmUgbm9uLW1vZHVsZXNcbiAgICBpZiAoY29udGV4dC5wYXJzZXJPcHRpb25zLnNvdXJjZVR5cGUgIT09ICdtb2R1bGUnKSB7XG4gICAgICByZXR1cm4ge31cbiAgICB9XG5cbiAgICByZXR1cm4ge1xuICAgICAgUHJvZ3JhbTogZnVuY3Rpb24gKGFzdCkge1xuICAgICAgICBpZiAoIWlzTW9kdWxlKGFzdCkpIHtcbiAgICAgICAgICBjb250ZXh0LnJlcG9ydCh7XG4gICAgICAgICAgICBub2RlOiBhc3QsXG4gICAgICAgICAgICBtZXNzYWdlOiAnVGhpcyBtb2R1bGUgY291bGQgYmUgcGFyc2VkIGFzIGEgdmFsaWQgc2NyaXB0LicsXG4gICAgICAgICAgfSlcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICB9XG5cbiAgfSxcbn1cbiJdfQ==
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
# eslint-plugin-import/memo-parser
|
||||
|
||||
|
||||
## NOTE!
|
||||
|
||||
This used to improve performance, but as of ESLint 5 and v2 of this plugin, it seems to just consume a bunch of memory and slightly increase lint times.
|
||||
|
||||
**Not recommended for use at this time!**
|
||||
|
||||
|
||||
This parser is just a memoizing wrapper around some actual parser.
|
||||
|
||||
To configure, just add your _actual_ parser to the `parserOptions`, like so:
|
||||
|
||||
```yaml
|
||||
parser: eslint-plugin-import/memo-parser
|
||||
# parser: babel-eslint
|
||||
|
||||
parserOptions:
|
||||
parser: babel-eslint
|
||||
sourceType: module
|
||||
ecmaVersion: 6
|
||||
```
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
"use strict"
|
||||
|
||||
const crypto = require('crypto')
|
||||
, moduleRequire = require('eslint-module-utils/module-require').default
|
||||
, hashObject = require('eslint-module-utils/hash').hashObject
|
||||
|
||||
const cache = new Map()
|
||||
|
||||
// must match ESLint default options or we'll miss the cache every time
|
||||
const parserOptions = {
|
||||
loc: true,
|
||||
range: true,
|
||||
raw: true,
|
||||
tokens: true,
|
||||
comment: true,
|
||||
attachComment: true,
|
||||
}
|
||||
|
||||
exports.parse = function parse(content, options) {
|
||||
options = Object.assign({}, options, parserOptions)
|
||||
|
||||
if (!options.filePath) {
|
||||
throw new Error("no file path provided!")
|
||||
}
|
||||
|
||||
const keyHash = crypto.createHash('sha256')
|
||||
keyHash.update(content)
|
||||
hashObject(options, keyHash)
|
||||
|
||||
const key = keyHash.digest('hex')
|
||||
|
||||
let ast = cache.get(key)
|
||||
if (ast != null) return ast
|
||||
|
||||
const realParser = moduleRequire(options.parser)
|
||||
|
||||
ast = realParser.parse(content, options)
|
||||
cache.set(key, ast)
|
||||
|
||||
return ast
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "memo-parser",
|
||||
"version": "0.2.0",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"description": "Memoizing wrapper for any ESLint-compatible parser module.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/benmosher/eslint-plugin-import.git"
|
||||
},
|
||||
"keywords": [
|
||||
"eslint",
|
||||
"eslint-plugin-import",
|
||||
"parser"
|
||||
],
|
||||
"author": "Ben Mosher (me@benmosher.com)",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/benmosher/eslint-plugin-import/issues"
|
||||
},
|
||||
"homepage": "https://github.com/benmosher/eslint-plugin-import#readme",
|
||||
"peerDependencies": {
|
||||
"eslint": ">=3.5.0"
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
v1.5.0 - October 13, 2016
|
||||
|
||||
* e33c6bb Update: Add support for BooleanLiteralType (#173) (Erik Arvidsson)
|
||||
|
||||
v1.4.0 - September 13, 2016
|
||||
|
||||
* d7426e5 Update: add ability to parse optional properties in typedefs (refs #5) (#174) (ikokostya)
|
||||
|
||||
v1.3.0 - August 22, 2016
|
||||
|
||||
* 12c7ad9 Update: Add support for numeric and string literal types (fixes #156) (#172) (Andrew Walter)
|
||||
|
||||
v1.2.3 - August 16, 2016
|
||||
|
||||
* b96a884 Build: Add CI release script (Nicholas C. Zakas)
|
||||
* 8d9b3c7 Upgrade: Upgrade esutils to v2.0.2 (fixes #170) (#171) (Emeegeemee)
|
||||
|
||||
v1.2.2 - May 19, 2016
|
||||
|
||||
* ebe0b08 Fix: Support case insensitive tags (fixes #163) (#164) (alberto)
|
||||
* 8e6d81e Chore: Remove copyright and license from headers (Nicholas C. Zakas)
|
||||
* 79035c6 Chore: Include jQuery Foundation copyright (Nicholas C. Zakas)
|
||||
* 06910a7 Fix: Preserve whitespace in default param string values (fixes #157) (Kai Cataldo)
|
||||
|
||||
v1.2.1 - March 29, 2016
|
||||
|
||||
* 1f54014 Fix: allow hyphens in names (fixes #116) (Kai Cataldo)
|
||||
* bbee469 Docs: Add issue template (Nicholas C. Zakas)
|
||||
|
||||
v1.2.0 - February 19, 2016
|
||||
|
||||
* 18136c5 Build: Cleanup build system (Nicholas C. Zakas)
|
||||
* b082f85 Update: Add support for slash in namepaths (fixes #100) (Ryan Duffy)
|
||||
* def53a2 Docs: Fix typo in option lineNumbers (Daniel Tschinder)
|
||||
* e2cbbc5 Update: Bump isarray to v1.0.0 (Shinnosuke Watanabe)
|
||||
* ae07aa8 Fix: Allow whitespace in optional param with default value (fixes #141) (chris)
|
||||
|
||||
v1.1.0 - January 6, 2016
|
||||
|
||||
* Build: Switch to Makefile.js (Nicholas C. Zakas)
|
||||
* New: support name expression for @this tag (fixes #143) (Tim Schaub)
|
||||
* Build: Update ESLint settings (Nicholas C. Zakas)
|
||||
|
||||
v1.0.0 - December 21, 2015
|
||||
|
||||
* New: parse caption tags in examples into separate property. (fixes #131) (Tom MacWright)
|
||||
|
||||
v0.7.2 - November 27, 2015
|
||||
|
||||
* Fix: Line numbers for some tags (fixes #138) Fixing issue where input was not consumed via advance() but was skipped when parsing tags resulting in sometimes incorrect reported lineNumber. (TEHEK)
|
||||
* Build: Add missing linefix package (Nicholas C. Zakas)
|
||||
|
||||
v0.7.1 - November 13, 2015
|
||||
|
||||
* Update: Begin switch to Makefile.js (Nicholas C. Zakas)
|
||||
* Fix: permit return tag without type (fixes #136) (Tom MacWright)
|
||||
* Fix: package.json homepage field (Bogdan Chadkin)
|
||||
* Fix: Parse array default syntax. Fixes #133 (Tom MacWright)
|
||||
* Fix: Last tag always has \n in the description (fixes #87) (Burak Yigit Kaya)
|
||||
* Docs: Add changelog (Nicholas C. Zakas)
|
||||
|
||||
v0.7.0 - September 21, 2015
|
||||
|
||||
* Docs: Update README with new info (fixes #127) (Nicholas C. Zakas)
|
||||
* Fix: Parsing fix for param with arrays and properties (fixes #111) (Gyandeep Singh)
|
||||
* Build: Add travis build (fixes #123) (Gyandeep Singh)
|
||||
* Fix: Parsing of parameter name without a type (fixes #120) (Gyandeep Singh)
|
||||
* New: added preserveWhitespace option (Aleks Totic)
|
||||
* New: Add "files" entry to only deploy select files (Rob Loach)
|
||||
* New: Add support and tests for typedefs. Refs #5 (Tom MacWright)
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
Doctrine
|
||||
Copyright jQuery Foundation and other contributors, https://jquery.org/
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
+202
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
+174
@@ -0,0 +1,174 @@
|
||||
[![NPM version][npm-image]][npm-url]
|
||||
[![build status][travis-image]][travis-url]
|
||||
[![Test coverage][coveralls-image]][coveralls-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
[](https://gitter.im/eslint/doctrine?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
# Doctrine
|
||||
|
||||
Doctrine is a [JSDoc](http://usejsdoc.org) parser that parses documentation comments from JavaScript (you need to pass in the comment, not a whole JavaScript file).
|
||||
|
||||
## Installation
|
||||
|
||||
You can install Doctrine using [npm](https://npmjs.com):
|
||||
|
||||
```
|
||||
$ npm install doctrine --save-dev
|
||||
```
|
||||
|
||||
Doctrine can also be used in web browsers using [Browserify](http://browserify.org).
|
||||
|
||||
## Usage
|
||||
|
||||
Require doctrine inside of your JavaScript:
|
||||
|
||||
```js
|
||||
var doctrine = require("doctrine");
|
||||
```
|
||||
|
||||
### parse()
|
||||
|
||||
The primary method is `parse()`, which accepts two arguments: the JSDoc comment to parse and an optional options object. The available options are:
|
||||
|
||||
* `unwrap` - set to `true` to delete the leading `/**`, any `*` that begins a line, and the trailing `*/` from the source text. Default: `false`.
|
||||
* `tags` - an array of tags to return. When specified, Doctrine returns only tags in this array. For example, if `tags` is `["param"]`, then only `@param` tags will be returned. Default: `null`.
|
||||
* `recoverable` - set to `true` to keep parsing even when syntax errors occur. Default: `false`.
|
||||
* `sloppy` - set to `true` to allow optional parameters to be specified in brackets (`@param {string} [foo]`). Default: `false`.
|
||||
* `lineNumbers` - set to `true` to add `lineNumber` to each node, specifying the line on which the node is found in the source. Default: `false`.
|
||||
|
||||
Here's a simple example:
|
||||
|
||||
```js
|
||||
var ast = doctrine.parse(
|
||||
[
|
||||
"/**",
|
||||
" * This function comment is parsed by doctrine",
|
||||
" * @param {{ok:String}} userName",
|
||||
"*/"
|
||||
].join('\n'), { unwrap: true });
|
||||
```
|
||||
|
||||
This example returns the following AST:
|
||||
|
||||
{
|
||||
"description": "This function comment is parsed by doctrine",
|
||||
"tags": [
|
||||
{
|
||||
"title": "param",
|
||||
"description": null,
|
||||
"type": {
|
||||
"type": "RecordType",
|
||||
"fields": [
|
||||
{
|
||||
"type": "FieldType",
|
||||
"key": "ok",
|
||||
"value": {
|
||||
"type": "NameExpression",
|
||||
"name": "String"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"name": "userName"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
See the [demo page](http://eslint.org/doctrine/demo/) more detail.
|
||||
|
||||
## Team
|
||||
|
||||
These folks keep the project moving and are resources for help:
|
||||
|
||||
* Nicholas C. Zakas ([@nzakas](https://github.com/nzakas)) - project lead
|
||||
* Yusuke Suzuki ([@constellation](https://github.com/constellation)) - reviewer
|
||||
|
||||
## Contributing
|
||||
|
||||
Issues and pull requests will be triaged and responded to as quickly as possible. We operate under the [ESLint Contributor Guidelines](http://eslint.org/docs/developer-guide/contributing), so please be sure to read them before contributing. If you're not sure where to dig in, check out the [issues](https://github.com/eslint/doctrine/issues).
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
### Can I pass a whole JavaScript file to Doctrine?
|
||||
|
||||
No. Doctrine can only parse JSDoc comments, so you'll need to pass just the JSDoc comment to Doctrine in order to work.
|
||||
|
||||
|
||||
### License
|
||||
|
||||
#### doctrine
|
||||
|
||||
Copyright (C) 2012 [Yusuke Suzuki](http://github.com/Constellation)
|
||||
(twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#### esprima
|
||||
|
||||
some of functions is derived from esprima
|
||||
|
||||
Copyright (C) 2012, 2011 [Ariya Hidayat](http://ariya.ofilabs.com/about)
|
||||
(twitter: [@ariyahidayat](http://twitter.com/ariyahidayat)) and other contributors.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
#### closure-compiler
|
||||
|
||||
some of extensions is derived from closure-compiler
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
|
||||
### Where to ask for help?
|
||||
|
||||
Join our [Chatroom](https://gitter.im/eslint/doctrine)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/doctrine.svg?style=flat-square
|
||||
[npm-url]: https://www.npmjs.com/package/doctrine
|
||||
[travis-image]: https://img.shields.io/travis/eslint/doctrine/master.svg?style=flat-square
|
||||
[travis-url]: https://travis-ci.org/eslint/doctrine
|
||||
[coveralls-image]: https://img.shields.io/coveralls/eslint/doctrine/master.svg?style=flat-square
|
||||
[coveralls-url]: https://coveralls.io/r/eslint/doctrine?branch=master
|
||||
[downloads-image]: http://img.shields.io/npm/dm/doctrine.svg?style=flat-square
|
||||
[downloads-url]: https://www.npmjs.com/package/doctrine
|
||||
+897
@@ -0,0 +1,897 @@
|
||||
/*
|
||||
* @fileoverview Main Doctrine object
|
||||
* @author Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
* @author Dan Tao <daniel.tao@gmail.com>
|
||||
* @author Andrew Eisenberg <andrew@eisenberg.as>
|
||||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var typed,
|
||||
utility,
|
||||
isArray,
|
||||
jsdoc,
|
||||
esutils,
|
||||
hasOwnProperty;
|
||||
|
||||
esutils = require('esutils');
|
||||
isArray = require('isarray');
|
||||
typed = require('./typed');
|
||||
utility = require('./utility');
|
||||
|
||||
function sliceSource(source, index, last) {
|
||||
return source.slice(index, last);
|
||||
}
|
||||
|
||||
hasOwnProperty = (function () {
|
||||
var func = Object.prototype.hasOwnProperty;
|
||||
return function hasOwnProperty(obj, name) {
|
||||
return func.call(obj, name);
|
||||
};
|
||||
}());
|
||||
|
||||
function shallowCopy(obj) {
|
||||
var ret = {}, key;
|
||||
for (key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
ret[key] = obj[key];
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
function isASCIIAlphanumeric(ch) {
|
||||
return (ch >= 0x61 /* 'a' */ && ch <= 0x7A /* 'z' */) ||
|
||||
(ch >= 0x41 /* 'A' */ && ch <= 0x5A /* 'Z' */) ||
|
||||
(ch >= 0x30 /* '0' */ && ch <= 0x39 /* '9' */);
|
||||
}
|
||||
|
||||
function isParamTitle(title) {
|
||||
return title === 'param' || title === 'argument' || title === 'arg';
|
||||
}
|
||||
|
||||
function isReturnTitle(title) {
|
||||
return title === 'return' || title === 'returns';
|
||||
}
|
||||
|
||||
function isProperty(title) {
|
||||
return title === 'property' || title === 'prop';
|
||||
}
|
||||
|
||||
function isNameParameterRequired(title) {
|
||||
return isParamTitle(title) || isProperty(title) ||
|
||||
title === 'alias' || title === 'this' || title === 'mixes' || title === 'requires';
|
||||
}
|
||||
|
||||
function isAllowedName(title) {
|
||||
return isNameParameterRequired(title) || title === 'const' || title === 'constant';
|
||||
}
|
||||
|
||||
function isAllowedNested(title) {
|
||||
return isProperty(title) || isParamTitle(title);
|
||||
}
|
||||
|
||||
function isAllowedOptional(title) {
|
||||
return isProperty(title) || isParamTitle(title);
|
||||
}
|
||||
|
||||
function isTypeParameterRequired(title) {
|
||||
return isParamTitle(title) || isReturnTitle(title) ||
|
||||
title === 'define' || title === 'enum' ||
|
||||
title === 'implements' || title === 'this' ||
|
||||
title === 'type' || title === 'typedef' || isProperty(title);
|
||||
}
|
||||
|
||||
// Consider deprecation instead using 'isTypeParameterRequired' and 'Rules' declaration to pick when a type is optional/required
|
||||
// This would require changes to 'parseType'
|
||||
function isAllowedType(title) {
|
||||
return isTypeParameterRequired(title) || title === 'throws' || title === 'const' || title === 'constant' ||
|
||||
title === 'namespace' || title === 'member' || title === 'var' || title === 'module' ||
|
||||
title === 'constructor' || title === 'class' || title === 'extends' || title === 'augments' ||
|
||||
title === 'public' || title === 'private' || title === 'protected';
|
||||
}
|
||||
|
||||
function trim(str) {
|
||||
return str.replace(/^\s+/, '').replace(/\s+$/, '');
|
||||
}
|
||||
|
||||
function unwrapComment(doc) {
|
||||
// JSDoc comment is following form
|
||||
// /**
|
||||
// * .......
|
||||
// */
|
||||
// remove /**, */ and *
|
||||
var BEFORE_STAR = 0,
|
||||
STAR = 1,
|
||||
AFTER_STAR = 2,
|
||||
index,
|
||||
len,
|
||||
mode,
|
||||
result,
|
||||
ch;
|
||||
|
||||
doc = doc.replace(/^\/\*\*?/, '').replace(/\*\/$/, '');
|
||||
index = 0;
|
||||
len = doc.length;
|
||||
mode = BEFORE_STAR;
|
||||
result = '';
|
||||
|
||||
while (index < len) {
|
||||
ch = doc.charCodeAt(index);
|
||||
switch (mode) {
|
||||
case BEFORE_STAR:
|
||||
if (esutils.code.isLineTerminator(ch)) {
|
||||
result += String.fromCharCode(ch);
|
||||
} else if (ch === 0x2A /* '*' */) {
|
||||
mode = STAR;
|
||||
} else if (!esutils.code.isWhiteSpace(ch)) {
|
||||
result += String.fromCharCode(ch);
|
||||
mode = AFTER_STAR;
|
||||
}
|
||||
break;
|
||||
|
||||
case STAR:
|
||||
if (!esutils.code.isWhiteSpace(ch)) {
|
||||
result += String.fromCharCode(ch);
|
||||
}
|
||||
mode = esutils.code.isLineTerminator(ch) ? BEFORE_STAR : AFTER_STAR;
|
||||
break;
|
||||
|
||||
case AFTER_STAR:
|
||||
result += String.fromCharCode(ch);
|
||||
if (esutils.code.isLineTerminator(ch)) {
|
||||
mode = BEFORE_STAR;
|
||||
}
|
||||
break;
|
||||
}
|
||||
index += 1;
|
||||
}
|
||||
|
||||
return result.replace(/\s+$/, '');
|
||||
}
|
||||
|
||||
// JSDoc Tag Parser
|
||||
|
||||
(function (exports) {
|
||||
var Rules,
|
||||
index,
|
||||
lineNumber,
|
||||
length,
|
||||
source,
|
||||
recoverable,
|
||||
sloppy,
|
||||
strict;
|
||||
|
||||
function advance() {
|
||||
var ch = source.charCodeAt(index);
|
||||
index += 1;
|
||||
if (esutils.code.isLineTerminator(ch) && !(ch === 0x0D /* '\r' */ && source.charCodeAt(index) === 0x0A /* '\n' */)) {
|
||||
lineNumber += 1;
|
||||
}
|
||||
return String.fromCharCode(ch);
|
||||
}
|
||||
|
||||
function scanTitle() {
|
||||
var title = '';
|
||||
// waste '@'
|
||||
advance();
|
||||
|
||||
while (index < length && isASCIIAlphanumeric(source.charCodeAt(index))) {
|
||||
title += advance();
|
||||
}
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
function seekContent() {
|
||||
var ch, waiting, last = index;
|
||||
|
||||
waiting = false;
|
||||
while (last < length) {
|
||||
ch = source.charCodeAt(last);
|
||||
if (esutils.code.isLineTerminator(ch) && !(ch === 0x0D /* '\r' */ && source.charCodeAt(last + 1) === 0x0A /* '\n' */)) {
|
||||
waiting = true;
|
||||
} else if (waiting) {
|
||||
if (ch === 0x40 /* '@' */) {
|
||||
break;
|
||||
}
|
||||
if (!esutils.code.isWhiteSpace(ch)) {
|
||||
waiting = false;
|
||||
}
|
||||
}
|
||||
last += 1;
|
||||
}
|
||||
return last;
|
||||
}
|
||||
|
||||
// type expression may have nest brace, such as,
|
||||
// { { ok: string } }
|
||||
//
|
||||
// therefore, scanning type expression with balancing braces.
|
||||
function parseType(title, last) {
|
||||
var ch, brace, type, direct = false;
|
||||
|
||||
|
||||
// search '{'
|
||||
while (index < last) {
|
||||
ch = source.charCodeAt(index);
|
||||
if (esutils.code.isWhiteSpace(ch)) {
|
||||
advance();
|
||||
} else if (ch === 0x7B /* '{' */) {
|
||||
advance();
|
||||
break;
|
||||
} else {
|
||||
// this is direct pattern
|
||||
direct = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (direct) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// type expression { is found
|
||||
brace = 1;
|
||||
type = '';
|
||||
while (index < last) {
|
||||
ch = source.charCodeAt(index);
|
||||
if (esutils.code.isLineTerminator(ch)) {
|
||||
advance();
|
||||
} else {
|
||||
if (ch === 0x7D /* '}' */) {
|
||||
brace -= 1;
|
||||
if (brace === 0) {
|
||||
advance();
|
||||
break;
|
||||
}
|
||||
} else if (ch === 0x7B /* '{' */) {
|
||||
brace += 1;
|
||||
}
|
||||
type += advance();
|
||||
}
|
||||
}
|
||||
|
||||
if (brace !== 0) {
|
||||
// braces is not balanced
|
||||
return utility.throwError('Braces are not balanced');
|
||||
}
|
||||
|
||||
if (isAllowedOptional(title)) {
|
||||
return typed.parseParamType(type);
|
||||
}
|
||||
|
||||
return typed.parseType(type);
|
||||
}
|
||||
|
||||
function scanIdentifier(last) {
|
||||
var identifier;
|
||||
if (!esutils.code.isIdentifierStartES5(source.charCodeAt(index))) {
|
||||
return null;
|
||||
}
|
||||
identifier = advance();
|
||||
while (index < last && esutils.code.isIdentifierPartES5(source.charCodeAt(index))) {
|
||||
identifier += advance();
|
||||
}
|
||||
return identifier;
|
||||
}
|
||||
|
||||
function skipWhiteSpace(last) {
|
||||
while (index < last && (esutils.code.isWhiteSpace(source.charCodeAt(index)) || esutils.code.isLineTerminator(source.charCodeAt(index)))) {
|
||||
advance();
|
||||
}
|
||||
}
|
||||
|
||||
function parseName(last, allowBrackets, allowNestedParams) {
|
||||
var name = '',
|
||||
useBrackets,
|
||||
insideString;
|
||||
|
||||
|
||||
skipWhiteSpace(last);
|
||||
|
||||
if (index >= last) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (allowBrackets && source.charCodeAt(index) === 0x5B /* '[' */) {
|
||||
useBrackets = true;
|
||||
name = advance();
|
||||
}
|
||||
|
||||
if (!esutils.code.isIdentifierStartES5(source.charCodeAt(index))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
name += scanIdentifier(last);
|
||||
|
||||
if (allowNestedParams) {
|
||||
if (source.charCodeAt(index) === 0x3A /* ':' */ && (
|
||||
name === 'module' ||
|
||||
name === 'external' ||
|
||||
name === 'event')) {
|
||||
name += advance();
|
||||
name += scanIdentifier(last);
|
||||
|
||||
}
|
||||
if(source.charCodeAt(index) === 0x5B /* '[' */ && source.charCodeAt(index + 1) === 0x5D /* ']' */){
|
||||
name += advance();
|
||||
name += advance();
|
||||
}
|
||||
while (source.charCodeAt(index) === 0x2E /* '.' */ ||
|
||||
source.charCodeAt(index) === 0x2F /* '/' */ ||
|
||||
source.charCodeAt(index) === 0x23 /* '#' */ ||
|
||||
source.charCodeAt(index) === 0x2D /* '-' */ ||
|
||||
source.charCodeAt(index) === 0x7E /* '~' */) {
|
||||
name += advance();
|
||||
name += scanIdentifier(last);
|
||||
}
|
||||
}
|
||||
|
||||
if (useBrackets) {
|
||||
skipWhiteSpace(last);
|
||||
// do we have a default value for this?
|
||||
if (source.charCodeAt(index) === 0x3D /* '=' */) {
|
||||
// consume the '='' symbol
|
||||
name += advance();
|
||||
skipWhiteSpace(last);
|
||||
|
||||
var ch;
|
||||
var bracketDepth = 1;
|
||||
|
||||
// scan in the default value
|
||||
while (index < last) {
|
||||
ch = source.charCodeAt(index);
|
||||
|
||||
if (esutils.code.isWhiteSpace(ch)) {
|
||||
if (!insideString) {
|
||||
skipWhiteSpace(last);
|
||||
ch = source.charCodeAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
if (ch === 0x27 /* ''' */) {
|
||||
if (!insideString) {
|
||||
insideString = '\'';
|
||||
} else {
|
||||
if (insideString === '\'') {
|
||||
insideString = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ch === 0x22 /* '"' */) {
|
||||
if (!insideString) {
|
||||
insideString = '"';
|
||||
} else {
|
||||
if (insideString === '"') {
|
||||
insideString = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ch === 0x5B /* '[' */) {
|
||||
bracketDepth++;
|
||||
} else if (ch === 0x5D /* ']' */ &&
|
||||
--bracketDepth === 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
name += advance();
|
||||
}
|
||||
}
|
||||
|
||||
skipWhiteSpace(last);
|
||||
|
||||
if (index >= last || source.charCodeAt(index) !== 0x5D /* ']' */) {
|
||||
// we never found a closing ']'
|
||||
return null;
|
||||
}
|
||||
|
||||
// collect the last ']'
|
||||
name += advance();
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
function skipToTag() {
|
||||
while (index < length && source.charCodeAt(index) !== 0x40 /* '@' */) {
|
||||
advance();
|
||||
}
|
||||
if (index >= length) {
|
||||
return false;
|
||||
}
|
||||
utility.assert(source.charCodeAt(index) === 0x40 /* '@' */);
|
||||
return true;
|
||||
}
|
||||
|
||||
function TagParser(options, title) {
|
||||
this._options = options;
|
||||
this._title = title.toLowerCase();
|
||||
this._tag = {
|
||||
title: title,
|
||||
description: null
|
||||
};
|
||||
if (this._options.lineNumbers) {
|
||||
this._tag.lineNumber = lineNumber;
|
||||
}
|
||||
this._last = 0;
|
||||
// space to save special information for title parsers.
|
||||
this._extra = { };
|
||||
}
|
||||
|
||||
// addError(err, ...)
|
||||
TagParser.prototype.addError = function addError(errorText) {
|
||||
var args = Array.prototype.slice.call(arguments, 1),
|
||||
msg = errorText.replace(
|
||||
/%(\d)/g,
|
||||
function (whole, index) {
|
||||
utility.assert(index < args.length, 'Message reference must be in range');
|
||||
return args[index];
|
||||
}
|
||||
);
|
||||
|
||||
if (!this._tag.errors) {
|
||||
this._tag.errors = [];
|
||||
}
|
||||
if (strict) {
|
||||
utility.throwError(msg);
|
||||
}
|
||||
this._tag.errors.push(msg);
|
||||
return recoverable;
|
||||
};
|
||||
|
||||
TagParser.prototype.parseType = function () {
|
||||
// type required titles
|
||||
if (isTypeParameterRequired(this._title)) {
|
||||
try {
|
||||
this._tag.type = parseType(this._title, this._last);
|
||||
if (!this._tag.type) {
|
||||
if (!isParamTitle(this._title) && !isReturnTitle(this._title)) {
|
||||
if (!this.addError('Missing or invalid tag type')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
this._tag.type = null;
|
||||
if (!this.addError(error.message)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (isAllowedType(this._title)) {
|
||||
// optional types
|
||||
try {
|
||||
this._tag.type = parseType(this._title, this._last);
|
||||
} catch (e) {
|
||||
//For optional types, lets drop the thrown error when we hit the end of the file
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype._parseNamePath = function (optional) {
|
||||
var name;
|
||||
name = parseName(this._last, sloppy && isAllowedOptional(this._title), true);
|
||||
if (!name) {
|
||||
if (!optional) {
|
||||
if (!this.addError('Missing or invalid tag name')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
this._tag.name = name;
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.parseNamePath = function () {
|
||||
return this._parseNamePath(false);
|
||||
};
|
||||
|
||||
TagParser.prototype.parseNamePathOptional = function () {
|
||||
return this._parseNamePath(true);
|
||||
};
|
||||
|
||||
|
||||
TagParser.prototype.parseName = function () {
|
||||
var assign, name;
|
||||
|
||||
// param, property requires name
|
||||
if (isAllowedName(this._title)) {
|
||||
this._tag.name = parseName(this._last, sloppy && isAllowedOptional(this._title), isAllowedNested(this._title));
|
||||
if (!this._tag.name) {
|
||||
if (!isNameParameterRequired(this._title)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// it's possible the name has already been parsed but interpreted as a type
|
||||
// it's also possible this is a sloppy declaration, in which case it will be
|
||||
// fixed at the end
|
||||
if (isParamTitle(this._title) && this._tag.type && this._tag.type.name) {
|
||||
this._extra.name = this._tag.type;
|
||||
this._tag.name = this._tag.type.name;
|
||||
this._tag.type = null;
|
||||
} else {
|
||||
if (!this.addError('Missing or invalid tag name')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
name = this._tag.name;
|
||||
if (name.charAt(0) === '[' && name.charAt(name.length - 1) === ']') {
|
||||
// extract the default value if there is one
|
||||
// example: @param {string} [somebody=John Doe] description
|
||||
assign = name.substring(1, name.length - 1).split('=');
|
||||
if (assign[1]) {
|
||||
this._tag['default'] = assign[1];
|
||||
}
|
||||
this._tag.name = assign[0];
|
||||
|
||||
// convert to an optional type
|
||||
if (this._tag.type && this._tag.type.type !== 'OptionalType') {
|
||||
this._tag.type = {
|
||||
type: 'OptionalType',
|
||||
expression: this._tag.type
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.parseDescription = function parseDescription() {
|
||||
var description = trim(sliceSource(source, index, this._last));
|
||||
if (description) {
|
||||
if ((/^-\s+/).test(description)) {
|
||||
description = description.substring(2);
|
||||
}
|
||||
this._tag.description = description;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.parseCaption = function parseDescription() {
|
||||
var description = trim(sliceSource(source, index, this._last));
|
||||
var captionStartTag = '<caption>';
|
||||
var captionEndTag = '</caption>';
|
||||
var captionStart = description.indexOf(captionStartTag);
|
||||
var captionEnd = description.indexOf(captionEndTag);
|
||||
if (captionStart >= 0 && captionEnd >= 0) {
|
||||
this._tag.caption = trim(description.substring(
|
||||
captionStart + captionStartTag.length, captionEnd));
|
||||
this._tag.description = trim(description.substring(captionEnd + captionEndTag.length));
|
||||
} else {
|
||||
this._tag.description = description;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.parseKind = function parseKind() {
|
||||
var kind, kinds;
|
||||
kinds = {
|
||||
'class': true,
|
||||
'constant': true,
|
||||
'event': true,
|
||||
'external': true,
|
||||
'file': true,
|
||||
'function': true,
|
||||
'member': true,
|
||||
'mixin': true,
|
||||
'module': true,
|
||||
'namespace': true,
|
||||
'typedef': true
|
||||
};
|
||||
kind = trim(sliceSource(source, index, this._last));
|
||||
this._tag.kind = kind;
|
||||
if (!hasOwnProperty(kinds, kind)) {
|
||||
if (!this.addError('Invalid kind name \'%0\'', kind)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.parseAccess = function parseAccess() {
|
||||
var access;
|
||||
access = trim(sliceSource(source, index, this._last));
|
||||
this._tag.access = access;
|
||||
if (access !== 'private' && access !== 'protected' && access !== 'public') {
|
||||
if (!this.addError('Invalid access name \'%0\'', access)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.parseThis = function parseAccess() {
|
||||
// this name may be a name expression (e.g. {foo.bar})
|
||||
// or a name path (e.g. foo.bar)
|
||||
var value = trim(sliceSource(source, index, this._last));
|
||||
if (value && value.charAt(0) === '{') {
|
||||
var gotType = this.parseType();
|
||||
if (gotType && this._tag.type.type === 'NameExpression') {
|
||||
this._tag.name = this._tag.type.name;
|
||||
return true;
|
||||
} else {
|
||||
return this.addError('Invalid name for this');
|
||||
}
|
||||
} else {
|
||||
return this.parseNamePath();
|
||||
}
|
||||
};
|
||||
|
||||
TagParser.prototype.parseVariation = function parseVariation() {
|
||||
var variation, text;
|
||||
text = trim(sliceSource(source, index, this._last));
|
||||
variation = parseFloat(text, 10);
|
||||
this._tag.variation = variation;
|
||||
if (isNaN(variation)) {
|
||||
if (!this.addError('Invalid variation \'%0\'', text)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.ensureEnd = function () {
|
||||
var shouldBeEmpty = trim(sliceSource(source, index, this._last));
|
||||
if (shouldBeEmpty) {
|
||||
if (!this.addError('Unknown content \'%0\'', shouldBeEmpty)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.epilogue = function epilogue() {
|
||||
var description;
|
||||
|
||||
description = this._tag.description;
|
||||
// un-fix potentially sloppy declaration
|
||||
if (isAllowedOptional(this._title) && !this._tag.type && description && description.charAt(0) === '[') {
|
||||
this._tag.type = this._extra.name;
|
||||
if (!this._tag.name) {
|
||||
this._tag.name = undefined;
|
||||
}
|
||||
|
||||
if (!sloppy) {
|
||||
if (!this.addError('Missing or invalid tag name')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
Rules = {
|
||||
// http://usejsdoc.org/tags-access.html
|
||||
'access': ['parseAccess'],
|
||||
// http://usejsdoc.org/tags-alias.html
|
||||
'alias': ['parseNamePath', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-augments.html
|
||||
'augments': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-constructor.html
|
||||
'constructor': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// Synonym: http://usejsdoc.org/tags-constructor.html
|
||||
'class': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// Synonym: http://usejsdoc.org/tags-extends.html
|
||||
'extends': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-example.html
|
||||
'example': ['parseCaption'],
|
||||
// http://usejsdoc.org/tags-deprecated.html
|
||||
'deprecated': ['parseDescription'],
|
||||
// http://usejsdoc.org/tags-global.html
|
||||
'global': ['ensureEnd'],
|
||||
// http://usejsdoc.org/tags-inner.html
|
||||
'inner': ['ensureEnd'],
|
||||
// http://usejsdoc.org/tags-instance.html
|
||||
'instance': ['ensureEnd'],
|
||||
// http://usejsdoc.org/tags-kind.html
|
||||
'kind': ['parseKind'],
|
||||
// http://usejsdoc.org/tags-mixes.html
|
||||
'mixes': ['parseNamePath', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-mixin.html
|
||||
'mixin': ['parseNamePathOptional', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-member.html
|
||||
'member': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-method.html
|
||||
'method': ['parseNamePathOptional', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-module.html
|
||||
'module': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// Synonym: http://usejsdoc.org/tags-method.html
|
||||
'func': ['parseNamePathOptional', 'ensureEnd'],
|
||||
// Synonym: http://usejsdoc.org/tags-method.html
|
||||
'function': ['parseNamePathOptional', 'ensureEnd'],
|
||||
// Synonym: http://usejsdoc.org/tags-member.html
|
||||
'var': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-name.html
|
||||
'name': ['parseNamePath', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-namespace.html
|
||||
'namespace': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-private.html
|
||||
'private': ['parseType', 'parseDescription'],
|
||||
// http://usejsdoc.org/tags-protected.html
|
||||
'protected': ['parseType', 'parseDescription'],
|
||||
// http://usejsdoc.org/tags-public.html
|
||||
'public': ['parseType', 'parseDescription'],
|
||||
// http://usejsdoc.org/tags-readonly.html
|
||||
'readonly': ['ensureEnd'],
|
||||
// http://usejsdoc.org/tags-requires.html
|
||||
'requires': ['parseNamePath', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-since.html
|
||||
'since': ['parseDescription'],
|
||||
// http://usejsdoc.org/tags-static.html
|
||||
'static': ['ensureEnd'],
|
||||
// http://usejsdoc.org/tags-summary.html
|
||||
'summary': ['parseDescription'],
|
||||
// http://usejsdoc.org/tags-this.html
|
||||
'this': ['parseThis', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-todo.html
|
||||
'todo': ['parseDescription'],
|
||||
// http://usejsdoc.org/tags-typedef.html
|
||||
'typedef': ['parseType', 'parseNamePathOptional'],
|
||||
// http://usejsdoc.org/tags-variation.html
|
||||
'variation': ['parseVariation'],
|
||||
// http://usejsdoc.org/tags-version.html
|
||||
'version': ['parseDescription']
|
||||
};
|
||||
|
||||
TagParser.prototype.parse = function parse() {
|
||||
var i, iz, sequences, method;
|
||||
|
||||
|
||||
// empty title
|
||||
if (!this._title) {
|
||||
if (!this.addError('Missing or invalid title')) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Seek to content last index.
|
||||
this._last = seekContent(this._title);
|
||||
|
||||
if (hasOwnProperty(Rules, this._title)) {
|
||||
sequences = Rules[this._title];
|
||||
} else {
|
||||
// default sequences
|
||||
sequences = ['parseType', 'parseName', 'parseDescription', 'epilogue'];
|
||||
}
|
||||
|
||||
for (i = 0, iz = sequences.length; i < iz; ++i) {
|
||||
method = sequences[i];
|
||||
if (!this[method]()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return this._tag;
|
||||
};
|
||||
|
||||
function parseTag(options) {
|
||||
var title, parser, tag;
|
||||
|
||||
// skip to tag
|
||||
if (!skipToTag()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// scan title
|
||||
title = scanTitle();
|
||||
|
||||
// construct tag parser
|
||||
parser = new TagParser(options, title);
|
||||
tag = parser.parse();
|
||||
|
||||
// Seek global index to end of this tag.
|
||||
while (index < parser._last) {
|
||||
advance();
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
//
|
||||
// Parse JSDoc
|
||||
//
|
||||
|
||||
function scanJSDocDescription(preserveWhitespace) {
|
||||
var description = '', ch, atAllowed;
|
||||
|
||||
atAllowed = true;
|
||||
while (index < length) {
|
||||
ch = source.charCodeAt(index);
|
||||
|
||||
if (atAllowed && ch === 0x40 /* '@' */) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (esutils.code.isLineTerminator(ch)) {
|
||||
atAllowed = true;
|
||||
} else if (atAllowed && !esutils.code.isWhiteSpace(ch)) {
|
||||
atAllowed = false;
|
||||
}
|
||||
|
||||
description += advance();
|
||||
}
|
||||
|
||||
return preserveWhitespace ? description : trim(description);
|
||||
}
|
||||
|
||||
function parse(comment, options) {
|
||||
var tags = [], tag, description, interestingTags, i, iz;
|
||||
|
||||
if (options === undefined) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
if (typeof options.unwrap === 'boolean' && options.unwrap) {
|
||||
source = unwrapComment(comment);
|
||||
} else {
|
||||
source = comment;
|
||||
}
|
||||
|
||||
// array of relevant tags
|
||||
if (options.tags) {
|
||||
if (isArray(options.tags)) {
|
||||
interestingTags = { };
|
||||
for (i = 0, iz = options.tags.length; i < iz; i++) {
|
||||
if (typeof options.tags[i] === 'string') {
|
||||
interestingTags[options.tags[i]] = true;
|
||||
} else {
|
||||
utility.throwError('Invalid "tags" parameter: ' + options.tags);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
utility.throwError('Invalid "tags" parameter: ' + options.tags);
|
||||
}
|
||||
}
|
||||
|
||||
length = source.length;
|
||||
index = 0;
|
||||
lineNumber = 0;
|
||||
recoverable = options.recoverable;
|
||||
sloppy = options.sloppy;
|
||||
strict = options.strict;
|
||||
|
||||
description = scanJSDocDescription(options.preserveWhitespace);
|
||||
|
||||
while (true) {
|
||||
tag = parseTag(options);
|
||||
if (!tag) {
|
||||
break;
|
||||
}
|
||||
if (!interestingTags || interestingTags.hasOwnProperty(tag.title)) {
|
||||
tags.push(tag);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
description: description,
|
||||
tags: tags
|
||||
};
|
||||
}
|
||||
exports.parse = parse;
|
||||
}(jsdoc = {}));
|
||||
|
||||
exports.version = utility.VERSION;
|
||||
exports.parse = jsdoc.parse;
|
||||
exports.parseType = typed.parseType;
|
||||
exports.parseParamType = typed.parseParamType;
|
||||
exports.unwrapComment = unwrapComment;
|
||||
exports.Syntax = shallowCopy(typed.Syntax);
|
||||
exports.Error = utility.DoctrineError;
|
||||
exports.type = {
|
||||
Syntax: exports.Syntax,
|
||||
parseType: typed.parseType,
|
||||
parseParamType: typed.parseParamType,
|
||||
stringify: typed.stringify
|
||||
};
|
||||
}());
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
+1283
File diff suppressed because it is too large
Load Diff
+35
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* @fileoverview Utilities for Doctrine
|
||||
* @author Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
*/
|
||||
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var VERSION;
|
||||
|
||||
VERSION = require('../package.json').version;
|
||||
exports.VERSION = VERSION;
|
||||
|
||||
function DoctrineError(message) {
|
||||
this.name = 'DoctrineError';
|
||||
this.message = message;
|
||||
}
|
||||
DoctrineError.prototype = (function () {
|
||||
var Middle = function () { };
|
||||
Middle.prototype = Error.prototype;
|
||||
return new Middle();
|
||||
}());
|
||||
DoctrineError.prototype.constructor = DoctrineError;
|
||||
exports.DoctrineError = DoctrineError;
|
||||
|
||||
function throwError(message) {
|
||||
throw new DoctrineError(message);
|
||||
}
|
||||
exports.throwError = throwError;
|
||||
|
||||
exports.assert = require('assert');
|
||||
}());
|
||||
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"doctrine@1.5.0",
|
||||
"/home/app"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "doctrine@1.5.0",
|
||||
"_id": "doctrine@1.5.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=",
|
||||
"_location": "/eslint-plugin-import/doctrine",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "doctrine@1.5.0",
|
||||
"name": "doctrine",
|
||||
"escapedName": "doctrine",
|
||||
"rawSpec": "1.5.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.5.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/eslint-plugin-import"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz",
|
||||
"_spec": "1.5.0",
|
||||
"_where": "/home/app",
|
||||
"bugs": {
|
||||
"url": "https://github.com/eslint/doctrine/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"esutils": "^2.0.2",
|
||||
"isarray": "^1.0.0"
|
||||
},
|
||||
"description": "JSDoc parser",
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.11.2",
|
||||
"dateformat": "^1.0.11",
|
||||
"eslint": "^1.10.3",
|
||||
"eslint-release": "^0.10.0",
|
||||
"istanbul": "^0.4.1",
|
||||
"linefix": "^0.1.1",
|
||||
"mocha": "^2.3.3",
|
||||
"npm-license": "^0.3.1",
|
||||
"semver": "^5.0.3",
|
||||
"shelljs": "^0.5.3",
|
||||
"shelljs-nodecli": "^0.1.1",
|
||||
"should": "^5.0.1"
|
||||
},
|
||||
"directories": {
|
||||
"lib": "./lib"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"LICENSE.BSD",
|
||||
"LICENSE.closure-compiler",
|
||||
"LICENSE.esprima",
|
||||
"README.md"
|
||||
],
|
||||
"homepage": "https://github.com/eslint/doctrine",
|
||||
"licenses": [
|
||||
{
|
||||
"type": "BSD",
|
||||
"url": "http://github.com/eslint/doctrine/raw/master/LICENSE.BSD"
|
||||
}
|
||||
],
|
||||
"main": "lib/doctrine.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Nicholas C. Zakas",
|
||||
"email": "nicholas+npm@nczconsulting.com",
|
||||
"url": "https://www.nczonline.net"
|
||||
},
|
||||
{
|
||||
"name": "Yusuke Suzuki",
|
||||
"email": "utatane.tea@gmail.com",
|
||||
"url": "https://github.com/Constellation"
|
||||
}
|
||||
],
|
||||
"name": "doctrine",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/eslint/doctrine.git"
|
||||
},
|
||||
"scripts": {
|
||||
"alpharelease": "eslint-prerelease alpha",
|
||||
"betarelease": "eslint-prerelease beta",
|
||||
"ci-release": "eslint-ci-release",
|
||||
"lint": "eslint lib/",
|
||||
"release": "eslint-release",
|
||||
"test": "npm run lint && node Makefile.js test"
|
||||
},
|
||||
"version": "1.5.0"
|
||||
}
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"eslint-plugin-import@2.18.2",
|
||||
"/home/app"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "eslint-plugin-import@2.18.2",
|
||||
"_id": "eslint-plugin-import@2.18.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-5ohpsHAiUBRNaBWAF08izwUGlbrJoJJ+W9/TBwsGoR1MnlgfwMIKrFeSjWbt6moabiXW9xNvtFz+97KHRfI4HQ==",
|
||||
"_location": "/eslint-plugin-import",
|
||||
"_phantomChildren": {
|
||||
"esutils": "2.0.3",
|
||||
"isarray": "1.0.0"
|
||||
},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "eslint-plugin-import@2.18.2",
|
||||
"name": "eslint-plugin-import",
|
||||
"escapedName": "eslint-plugin-import",
|
||||
"rawSpec": "2.18.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "2.18.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#DEV:/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.18.2.tgz",
|
||||
"_spec": "2.18.2",
|
||||
"_where": "/home/app",
|
||||
"author": {
|
||||
"name": "Ben Mosher",
|
||||
"email": "me@benmosher.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/benmosher/eslint-plugin-import/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"array-includes": "^3.0.3",
|
||||
"contains-path": "^0.1.0",
|
||||
"debug": "^2.6.9",
|
||||
"doctrine": "1.5.0",
|
||||
"eslint-import-resolver-node": "^0.3.2",
|
||||
"eslint-module-utils": "^2.4.0",
|
||||
"has": "^1.0.3",
|
||||
"minimatch": "^3.0.4",
|
||||
"object.values": "^1.1.0",
|
||||
"read-pkg-up": "^2.0.0",
|
||||
"resolve": "^1.11.0"
|
||||
},
|
||||
"description": "Import with sanity.",
|
||||
"devDependencies": {
|
||||
"@eslint/import-test-order-redirect-scoped": "file:./tests/files/order-redirect-scoped",
|
||||
"@typescript-eslint/parser": "1.10.3-alpha.13",
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-eslint": "^8.2.6",
|
||||
"babel-plugin-istanbul": "^4.1.6",
|
||||
"babel-preset-es2015-argon": "latest",
|
||||
"babel-register": "^6.26.0",
|
||||
"babylon": "^6.15.0",
|
||||
"chai": "^4.2.0",
|
||||
"coveralls": "^3.0.2",
|
||||
"cross-env": "^4.0.0",
|
||||
"eslint": "2.x - 6.x",
|
||||
"eslint-import-resolver-node": "file:./resolvers/node",
|
||||
"eslint-import-resolver-typescript": "^1.0.2",
|
||||
"eslint-import-resolver-webpack": "file:./resolvers/webpack",
|
||||
"eslint-import-test-order-redirect": "file:./tests/files/order-redirect",
|
||||
"eslint-module-utils": "file:./utils",
|
||||
"eslint-plugin-import": "2.x",
|
||||
"linklocal": "^2.8.2",
|
||||
"mocha": "^3.5.3",
|
||||
"nyc": "^11.9.0",
|
||||
"redux": "^3.7.2",
|
||||
"rimraf": "^2.6.3",
|
||||
"semver": "^6.0.0",
|
||||
"sinon": "^2.4.1",
|
||||
"typescript": "~3.2.2",
|
||||
"typescript-eslint-parser": "^22.0.0"
|
||||
},
|
||||
"directories": {
|
||||
"test": "tests"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"config",
|
||||
"memo-parser"
|
||||
],
|
||||
"homepage": "https://github.com/benmosher/eslint-plugin-import",
|
||||
"keywords": [
|
||||
"eslint",
|
||||
"eslintplugin",
|
||||
"es6",
|
||||
"jsnext",
|
||||
"modules",
|
||||
"import",
|
||||
"export"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "eslint-plugin-import",
|
||||
"nyc": {
|
||||
"require": [
|
||||
"babel-register"
|
||||
],
|
||||
"sourceMap": false,
|
||||
"instrument": false,
|
||||
"include": [
|
||||
"src/",
|
||||
"resolvers/"
|
||||
]
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": "2.x - 6.x"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/benmosher/eslint-plugin-import.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "babel --quiet --out-dir lib src",
|
||||
"coveralls": "nyc report --reporter lcovonly && cat ./coverage/lcov.info | coveralls",
|
||||
"mocha": "cross-env BABEL_ENV=test NODE_PATH=./src nyc -s mocha -R dot --recursive -t 5s",
|
||||
"posttest": "eslint ./src",
|
||||
"prebuild": "rimraf lib",
|
||||
"prepublish": "npm run build",
|
||||
"pretest": "linklocal",
|
||||
"test": "npm run mocha tests/src",
|
||||
"test-all": "npm test && for resolver in ./resolvers/*; do cd $resolver && npm test && cd ../..; done",
|
||||
"test-compiled": "npm run prepublish && NODE_PATH=./lib mocha --compilers js:babel-register --recursive tests/src",
|
||||
"watch": "npm run mocha -- --watch tests/src"
|
||||
},
|
||||
"version": "2.18.2"
|
||||
}
|
||||
Reference in New Issue
Block a user