add sparse array check to lint
MODIFY
packages/@romejs/js-compiler/transforms/lint/index.ts
packages/@romejs/js-compiler/transforms/lint/index.ts
@@ -9,10 +9,12 @@ import defaultExportSameBasename from './defaultExportSameBasename';
import undeclaredVariables from './undeclaredVariables';
import unusedVariables from './unusedVariables';
import emptyBlocks from './emptyBlocks';
+import sparseArray from './sparseArray';
export const lintTransforms = [
undeclaredVariables,
defaultExportSameBasename,
unusedVariables,
emptyBlocks,
+ sparseArray,
];

ADD
packages/@romejs/js-compiler/transforms/lint/sparseArray.ts
+import {Path} from '@romejs/js-compiler';
+import {AnyNode} from '@romejs/js-ast';
+
+export default {
+ name: 'sparseArray',
+ enter(path: Path): AnyNode {
+ const { node } = path;
+ if (node.type === 'ArrayExpression' &&
+ node.elements.includes(undefined)) {
+ path.context.addNodeDiagnostic(node, {
+ category: 'lint/sparseArray',
+ message: 'Your array contains an empty slot'
+ })
+ }
+ return node;
+ }
+}
\ No newline at end of file

add sparse array check to lint