mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-20 13:35:11 +08:00
Will be used to make sure no default exports are in DevTools. The PRESUBMIT.py has been updated to skip running the formatting check if node_modules files are affected, to workaround crbug.com/1068198. DISABLE_THIRD_PARTY_CHECK=Add plugin to node_modules Bug: 1068198 Change-Id: I04d4dc813daa01099f21d40edf47aaefcc0b045f Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2135610 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
1.4 KiB
1.4 KiB
import/newline-after-import
Enforces having one or more empty lines after the last top-level import statement or require call.
+(fixable) The --fix option on the [command line] automatically fixes problems reported by this rule.
Rule Details
This rule has one option, count which sets the number of newlines that are enforced after the last top-level import statement or require call. This option defaults to 1.
Valid:
import defaultExport from './foo'
const FOO = 'BAR'
import defaultExport from './foo'
import { bar } from 'bar-lib'
const FOO = 'BAR'
const FOO = require('./foo')
const BAR = require('./bar')
const BAZ = 1
Invalid:
import * as foo from 'foo'
const FOO = 'BAR'
import * as foo from 'foo'
const FOO = 'BAR'
import { bar } from 'bar-lib'
const FOO = require('./foo')
const BAZ = 1
const BAR = require('./bar')
With count set to 2 this will be considered valid:
import defaultExport from './foo'
const FOO = 'BAR'
With count set to 2 these will be considered invalid:
import defaultExport from './foo'
const FOO = 'BAR'
import defaultExport from './foo'
const FOO = 'BAR'
Example options usage
{
"rules": {
"import/newline-after-import": ["error", { "count": 2 }]
}
}
When Not To Use It
If you like to visually group module imports with its usage, you don't want to use this rule.