Skip to content

Commit 0428768

Browse files
committed
default to all extensions valid to avoid breaking change until semver-next
1 parent 7775f34 commit 0428768

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

Diff for: CHANGELOG.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
99
- Added an `optionalDependencies` option to [`no-extraneous-dependencies`] to allow/forbid optional dependencies ([#266], thanks [@jfmengels]).
1010
- Added `newlines-between` option to [`order`] rule ([#298], thanks [@singles])
1111
- add [`no-mutable-exports`] rule ([#290], thanks [@josh])
12+
- [`import/extensions` setting]: a whitelist of file extensions to parse as modules
13+
and search for `export`s. If unspecified, all extensions are considered valid (for now).
14+
In v2, this will likely default to `['.js', MODULE_EXT]`,. ([#297], to fix [#267])
1215

1316
### Fixed
1417
- [`extensions`]: fallback to source path for extension enforcement if imported
1518
module is not resolved. Also, never report for builtins (i.e. `path`). ([#296])
1619

17-
### Breaking
18-
- [`import/extensions` setting]: a whitelist of file extensions to parse as modules
19-
and search for `export`s. Defaults to `['.js']`.
20-
2120
## resolvers/webpack/0.2.4 - 2016-04-29
2221
### Changed
2322
- automatically find webpack config with `interpret`-able extensions ([#287], thanks [@taion])
@@ -203,6 +202,10 @@ for info on changes for earlier releases.
203202
[`no-mutable-exports`]: ./docs/rules/no-mutable-exports.md
204203

205204
[#298]: https://github.com/benmosher/eslint-plugin-import/pull/298
205+
<<<<<<< 7775f344b90aa44c446d596e4e137d6a725bf5e8
206+
=======
207+
[#297]: https://github.com/benmosher/eslint-plugin-import/pull/297
208+
>>>>>>> default to all extensions valid to avoid breaking change until semver-next
206209
[#296]: https://github.com/benmosher/eslint-plugin-import/pull/296
207210
[#290]: https://github.com/benmosher/eslint-plugin-import/pull/290
208211
[#289]: https://github.com/benmosher/eslint-plugin-import/pull/289
@@ -226,6 +229,7 @@ for info on changes for earlier releases.
226229
[#286]: https://github.com/benmosher/eslint-plugin-import/issues/286
227230
[#281]: https://github.com/benmosher/eslint-plugin-import/issues/281
228231
[#272]: https://github.com/benmosher/eslint-plugin-import/issues/272
232+
[#267]: https://github.com/benmosher/eslint-plugin-import/issues/267
229233
[#266]: https://github.com/benmosher/eslint-plugin-import/issues/266
230234
[#216]: https://github.com/benmosher/eslint-plugin-import/issues/216
231235
[#214]: https://github.com/benmosher/eslint-plugin-import/issues/214

Diff for: README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,10 @@ You may set the following settings in your `.eslintrc`:
150150
#### `import/extensions`
151151

152152
A whitelist of file extensions that will be parsed as modules and inspected for
153-
`export`s. This defaults to `['.js']`, unless you are using the `react` shared config,
154-
in which case it is specified as `['.js', '.jsx']`.
153+
`export`s.
154+
155+
This will default to `['.js']` in the next major revision of this plugin, unless
156+
you are using the `react` shared config, in which case it is specified as `['.js', '.jsx']`.
155157

156158
Note that this is different from (and likely a subset of) any `import/resolver`
157159
extensions settings, which may include `.json`, `.coffee`, etc. which will still

Diff for: src/core/ignore.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ function validExtensions({ settings }) {
1010

1111
// todo: add 'mjs'?
1212
lastSettings = settings
13-
cachedSet = new Set(settings['import/extensions'] || [ '.js' ])
13+
// breaking: default to '.js'
14+
// cachedSet = new Set(settings['import/extensions'] || [ '.js' ])
15+
cachedSet = 'import/extensions' in settings
16+
? new Set(settings['import/extensions'])
17+
: { has: () => true } // the set of all elements
18+
1419
return cachedSet
1520
}
1621

Diff for: tests/src/utils.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ export const SYNTAX_CASES = [
5858
test({ code: 'export default class x {}' }),
5959

6060
// issue #267: parser whitelist
61-
test({ code: 'import json from "./data.json"' }),
61+
test({
62+
code: 'import json from "./data.json"',
63+
settings: { 'import/extensions': ['.js'] }, // breaking: remove for v2
64+
}),
6265

6366
]

0 commit comments

Comments
 (0)