1.0.0 • Published 2 years ago
eslint-plugin-import-curly-newline v1.0.0
eslint-plugin-import-curly-newlines
import curly newlines
Installation
You'll first need to install ESLint:
npm i eslint --save-devNext, install eslint-plugin-import-curly-newlines:
npm install eslint-plugin-import-curly-newlines --save-devUsage
Add import-curly-newlines to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
{
"plugins": ["import-curly-newlines"]
}Then configure the rules you want to use under the rules section.
| name | type | default | description |
|---|---|---|---|
| count | number | 3 | If it exceeds count, each attribute will be wrapped. |
{
"rules": {
"import-curly-newlines/newlines": [
"error",
{
"count": 4
}
]
}
}valid
import A from 'C'
import * as A from 'C'
// count defalut 3
import {A, B} from 'C'
import {
A as AA,
B
} from 'C'
import A, {
AA as AAA,
B as BB,
C,
} from 'D'
import {
A as AA,
B,
} from 'C'
import A, {
AA as AAA,
B as BB,
C,
} from 'D'invalid
// invalid
import {
A as AA,B, C} from 'C'
// ||
// \/
// valid
import {
A as AA,
B,
C
} from 'C'
// invalid
import {
A as AA,B,
C,
} from 'C'
// ||
// \/
// valid, Commas will be preserved
import {
A as AA,
B,
C,
} from 'C'