Skip to content

Latest commit

 

History

History
61 lines (43 loc) · 648 Bytes

import-index.md

File metadata and controls

61 lines (43 loc) · 648 Bytes

Enforce importing index files with .

Enforces importing index file with . instead of ./, ./index or ./index.js.

Fail

const m = require('./');
const m = require('../');
const m = require('./index');
const m = require('./index.js');
const m = require('./foo/index.js');
const m = require('@foo/bar/index');
import m from './';
import m from './index';

Pass

const m = require('.');
const m = require('..');
const m = require('./foo');
const m = require('@foo/bar');
import m from '.';