alexjuarez / eslint-plugin-import-order-autofix Goto Github PK
View Code? Open in Web Editor NEWAn extension of eslint-pluigin-import that adds the fix option
An extension of eslint-pluigin-import that adds the fix option
Very nice plugin, seems to work very well!
May I ask why the fix feature isn't part of eslint-plugin-import/order
?
When using the --fix option my react-fontawesome import was deleted ...
Settings
"import-order-autofix/order": ["error", {"newlines-between": "always"}]
Original
import PropTypes from 'prop-types';
import React, {Component} from 'react';
import {withRouter} from 'react-router';
import {Nav, NavItem} from 'react-bootstrap';
import StudyToolbarItem from './study-life-cycle-item.jsx';
import STUDY_PHASE_STATUS_TYPES from '../../../models/constants/study-phase-status-types';
import FontAwesome from 'react-fontawesome';
After Fix
import PropTypes from 'prop-types';
import React, {Component} from 'react';
import {withRouter} from 'react-router';
import {Nav, NavItem} from 'react-bootstrap';
import STUDY_PHASE_STATUS_TYPES from '../../../models/constants/study-phase-status-types';
import StudyToolbarItem from './study-life-cycle-item.jsx';
When using with typescript I get
Error: did not recognize object of type "TSTypeAliasDeclaration"
#Hi Alex, thanks for all your hard work!
Unfortunately, I can't seem to get this to work. I keep getting this error when I try to run my linter:
ESLint couldn't find the plugin "eslint-plugin-import-order-autofix". This can happen for a couple different reasons:
1. If ESLint is installed globally, then make sure eslint-plugin-import-order-autofix is also installed globally. A globally-installed ESLint cannot find a locally-installed plugin.
2. If ESLint is installed locally, then it's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
npm i eslint-plugin-import-order-autofix@latest --save-dev
If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.
Of course, I've made sure to check the suggestions.
The eslint plugin is installed and present in node_modules:
// in package.json
"eslint": "^3.14.1",
"eslint-config-airbnb": "^14.0.0",
"eslint-import-resolver-webpack": "^0.8.1",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-import-order-autofix": "^0.8.3",
"eslint-plugin-jsx-a11y": "^3.0.2",
"eslint-plugin-react": "^6.9.0",
The rule is added to the ESlint config:
// in .esintrc
{
"plugins": [
"react",
"jsx-a11y",
"import-order-autofix"
],
"rules": {
"react/no-array-index-key": 1,
"import-order-autofix/order": 1
}
}
I've made sure to run the local ESlint:
./node_modules/.bin/eslint --fix --ext .jsx,.js .
I've tried removing the node_modules
folder. I've also tried installing ESlint and this plugin globally, but keep getting the same error.
Do you perhaps know something else I can try?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.