CLI running but not adding to file
mweber-ak opened this issue · comments
When I try running `importjs fix``` on the specified file from the CLI it outputs the below but doesn't actually change the file. The file has no imports in it.
\Documents\GitHub\platformx\client> importjs fix src/views/Customer.js
{"messages":["Added 3 imports"],"fileContent":"import { Switch } from '@material-ui/core';\nimport { connect } from 'react-redux';\nimport React from 'react';\n\nconst Customer = props => {\r\n return (\r\n <Switch>\r\n <Route\r\n exact\r\n path=\"/customer\"\r\n render={props => <CustomerDisplay customer={props.customer} />}\r\n />\r\n <Route\r\n path=\"/customer/planned\"\r\n render={props => <CustomerLoadsDisplay customer={props.customer} />}\r\n />\r\n <Route\r\n path=\"/customer/load-history\"\r\n render={props => <CustomerHistoryDisplay customer={props.customer} />}\r\n />\r\n <Route\r\n path=\"/customer/in-transit\"\r\n render={props => <CustomerInTransitDisplay customer={props.customer} />}\r\n />\r\n </Switch>\r\n );\r\n};\r\n\r\nconst mapStateToProps = state => ({\r\n customer: state.customer,\r\n auth: state.auth,\r\n});\r\n\r\nexport default connect(\r\n mapStateToProps,\r\n {}\r\n)(Customer);\r\n","unresolvedImports":{"CustomerDisplay":[{"displayName":"import { CustomerDisplay } from '../components/templates';","importPath":"../components/templates","data":{"importPath":"../components/templates","filePath":"src/components/templates/index.js","isNamedExport":true}},{"displayName":"import CustomerDisplay from '../components/templates/CustomerDisplay';","importPath":"../components/templates/CustomerDisplay","data":{"importPath":"../components/templates/CustomerDisplay","filePath":"./src/components/templates/CustomerDisplay.js","isNamedExport":false}}],"CustomerLoadsDisplay":[{"displayName":"import { CustomerLoadsDisplay } from '../components/templates';","importPath":"../components/templates","data":{"importPath":"../components/templates","filePath":"src/components/templates/index.js","isNamedExport":true}},{"displayName":"import CustomerLoadsDisplay from '../components/templates/CustomerLoadsDisplay';","importPath":"../components/templates/CustomerLoadsDisplay","data":{"importPath":"../components/templates/CustomerLoadsDisplay","filePath":"./src/components/templates/CustomerLoadsDisplay.js","isNamedExport":false}}],"CustomerHistoryDisplay":[{"displayName":"import { CustomerHistoryDisplay } from '../components/templates';","importPath":"../components/templates","data":{"importPath":"../components/templates","filePath":"src/components/templates/index.js","isNamedExport":true}},{"displayName":"import CustomerHistoryDisplay from '../components/templates/CustomerHistoryDisplay';","importPath":"../components/templates/CustomerHistoryDisplay","data":{"importPath":"../components/templates/CustomerHistoryDisplay","filePath":"./src/components/templates/CustomerHistoryDisplay.js","isNamedExport":false}}],"CustomerInTransitDisplay":[{"displayName":"import { CustomerInTransitDisplay } from '../components/templates';","importPath":"../components/templates","data":{"importPath":"../components/templates","filePath":"src/components/templates/index.js","isNamedExport":true}},{"displayName":"import CustomerInTransitDisplay from '../components/templates/CustomerInTransitDisplay';","importPath":"../components/templates/CustomerInTransitDisplay","data":{"importPath":"../components/templates/CustomerInTransitDisplay","filePath":"./src/components/templates/CustomerInTransitDisplay.js","isNamedExport":false}}]}}
My Config
module.exports = {
excludes: [
'./react-components/**/test/**'
],
environments: ['node'],
stripFileExtensions: ['.web.js', '.js']
}
I tried from the VS-Code Extension and got strange behavior, it would add it for a second until it came to a point where it would ask me which file to import from, if I select an answer it clears all the previous imports.