UNPKG

eslint-config-jhh

Version:

JHH ESLint config

99 lines (78 loc) 3.13 kB
/** * These rules relate to the `eslint-plugin-import` plugin. * * @see https://github.com/benmosher/eslint-plugin-import */ module.exports = { env: { es6: true }, parserOptions: { ecmaVersion: 6, sourceType: 'module' }, plugins: ['import'], settings: { 'import/resolver': { node: { extensions: ['.js', '.json'] } }, 'import/extensions': ['.js', '.jsx'], 'import/ignore': [ 'node_modules', // Add extensions as they become necessary '\\.(scss|css||svg|json)$' ] }, rules: { // ensure imports point to a file/module that can be resolved 'import/no-unresolved': ['error', { commonjs: true, caseSensitive: true }], // ensure named imports correspond to a named export in the remote file // Turned off because we are using commonjs 'import/named': 'off', // ensure default import coupled with default export // Turned off because we are using commonjs 'import/default': 'off', // ensure imported namespaces contain dereferenced properties as they // are dereferenced // turned off because I'm not clear on how it will behave 'import/namespace': 'off', // forbid import of modules using absolute paths 'import/no-absolute-path': 'error', // forbid Webpack loader syntax in imports 'import/no-webpack-loader-syntax': 'warn', // report any invalid exports, i.e. re-export of the same name 'import/export': 'error', // report use of exported name as identifier of default export 'import/no-named-as-default': 'error', // report use of exported name as property of default export 'import/no-named-as-default-member': 'error', // report imported names marked with @deprecated documentation tag // If you throw a @deprecated tag into a comment block it will warn 'import/no-deprecated': 'warn', // forbid require() calls with expressions 'import/no-dynamic-require': 'warn', // forbid the use of mutable exports with var or let 'import/no-mutable-exports': 'error', // report CommonJS require calls and module.exports or exports.* // Turned off because we are doing exactly this 'import/no-commonjs': 'off', // report AMD require and define calls 'import/no-amd': 'error', // ensure all imports appear before other statements 'import/first': 'error', // report repeated import of the same module in multiple places 'import/no-duplicates': 'error', // report namespace imports // Turned off because destructuring imports is a little wonky 'import/no-namespace': 'off', // enforce a newline after import statements 'import/newline-after-import': 'warn', // prefer a default export if module exports a single name 'import/prefer-default-export': 'warn' } }