A tool to simplify importing JS modules
MIT License
Bot releases are hidden (Show)
Published by trotzig over 8 years ago
Two new configuration options added in this release:
group_imports
- set to false to disable the default behavior of grouping importsenvironments
- set to ["node"]
to get access to core modules for Node.jsApart from that, the Sublime plugin should now be easier to get up and running thanks to work by @lencioni.
Published by trotzig over 8 years ago
Changes:
Published by trotzig over 8 years ago
tab
and max_line_length
has been moved to configuration (was previously controlled by the editor)goto
is now no longer experimental (after a few important improvements was made)import-js
CLI tool is now able to overwrite a file (--overwrite
flag), as well as rewriting all imports for a file (--rewrite
flag).Starting with version 0.5.0, imports are now split into groups. Package
dependencies come first, followed by one or more groups containing "internal"
imports. It will look something like this:
import React from 'react';
import { debounce } from 'underscore';
import Button from 'components/Button'
import Icon from 'components/Icon';
To prepare your codebase for the change in one sweep, you can run the following
command:
find ./app -name "**.js" -exec import-js {} --overwrite --rewrite \;
You will need to adapt it to fit your project. And please note that this command
is destructive - it will overwrite all files matched by the find
pattern.
Thanks to @lencioni for making the grouping feature happen!
Published by trotzig over 8 years ago
Changes:
let
is no longer supported as a declaration_keyword
.goto
is now even better
main
file specified, and with main
pointing to a directoryThanks to @lencioni for making this release happen.
Published by trotzig over 8 years ago
minimum_version
configuration option that you can use to warn people using old versions of import-js
.React
is now automatically imported if you are using jsx and have the react-in-scope
plugin installed and enabled.goto
to make it work in more situations.destructure
from aliases
into a new, named_exports
, configuration option.devDependencies
, by enabling the import_dev_dependencies
option.lookup_paths
value (['.']
).If you are using aliases
with nested destructure
arrays, turn them into named_exports
instead. Here's how it was previously done:
"aliases": {
"_": {
"path": "underscore",
"destructure": [
"omit",
"debounce"
]
}
}
This is how it should look now:
"aliases": {
"_": "underscore"
},
"named_exports": {
"underscore": [
"omit",
"debounce"
]
}
Thanks to @lencioni for making sure that this release is as exciting as possible!
Published by trotzig almost 9 years ago
Changes:
.
)ignore_package_prefixes
so that you can use a variable named e.g. foo
to import a package named brigade-foo
.mockComponent
matches foo/bar/mocks/component.js
.Thanks to @lencioni for filing a bunch of issues leading up to these enhancements.
Published by trotzig almost 9 years ago
Changes:
declaration_keyword
keyword has changed from var
to import
. If you were using var
before, and would like to keep it, you need to add this to your .importjs.json file:"declaration_keyword": "var"
eslint_executable
so that you can use e.g. a locally installed eslint (by @lencioni)Published by trotzig almost 9 years ago
Changes:
slop
gem, but now it's official)Thanks to @lencioni once again for spearheading recent feature work.
Published by trotzig almost 9 years ago
This version fixes a few minor issues introduced in 0.2.3.
Published by trotzig almost 9 years ago
This version improves import statements that use both a default variable and a list of destructured properties.
From the commit message in a307e0a5 (slightly altered here):
Currently, with aliases
configuration like the following:
"React": {
"path": "react",
"destructure": [
"PropTypes"
]
}
importing both React
and PropTypes
will result in:
import React from 'react';
import { PropTypes } from 'react';
but it would be better if it instead resulted in:
import React, { PropTypes } from 'react';
This commit makes this happen. Unfortunately, there doesn't seem to be
any equivalent syntax for CommonJS imports, so I made it simply add a
following statement that does the destructuring:
const React = require('react');
const { PropTypes } = require('react');
Thanks to @lencioni for the contribution
Published by trotzig almost 9 years ago
Changes:
Published by trotzig almost 9 years ago
Changes:
try_process': unknown option
--fix' (Slop::UnknownOption)`)Breaking change: The default Sublime setting for executable
has changed to just import-js
, from previously being ~/.rbenv/shims/import-js
. If you were relying on the rbenv path, you need to override the executable
setting with a full path to the import-js executable. Create or edit <path-to-sublime>/Packages/User/ImportJS.sublime-settings
with something that looks like this:
{
"executable": "/Users/henrictrotzig/.rbenv/shims/import-js"
}
Please note that you can't use ~
to refer to the home directory, you need to specify the full path.
Published by trotzig almost 9 years ago
Changes:
import_all
. We instead rely on fix_imports
.Published by trotzig almost 9 years ago
Adds "fix imports" command to Sublime.
Published by trotzig almost 9 years ago
Fixes a bug with importing all / fix imports when using jsx.
I accidentally pushed 0.1.3 prematurely to rubygems, so that's why this is 0.1.4 instead of 0.1.3.
Published by trotzig almost 9 years ago
This version contains some checks to make sure that the import-js gem is installed and available. It also adds some messaging to when the plugin is installed via Package Control.
Published by trotzig almost 9 years ago
Changes:
goto
option for Sublime{filename}
in aliases support for Emacs and SublimePublished by trotzig almost 9 years ago
This version improves the support for Sublime. The command line interface (import-js
) has been enhanced to support more use cases:
With these changes, the Sublime plugin can now do the following:
Published by trotzig almost 9 years ago
First gem release with proper support for Emacs.
Thanks to @lencioni, @kevinkehl and @syohex for your contributions.