623 lines
20 KiB
Diff
623 lines
20 KiB
Diff
diff --git a/.babelrc b/.babelrc
|
|
index 883c03b7..0111d616 100644
|
|
--- a/.babelrc
|
|
+++ b/.babelrc
|
|
@@ -1,18 +1,11 @@
|
|
{
|
|
- "presets": ["airbnb"],
|
|
- "sourceMaps": "inline",
|
|
- "retainLines": true,
|
|
+ "presets": [["@babel/preset-env", { "targets": { "node": 16 } }]],
|
|
"env": {
|
|
"test": {
|
|
- "plugins": [
|
|
- "istanbul",
|
|
- ["module-resolver", { "root": ["./src/"] }],
|
|
- ]
|
|
+ "plugins": ["istanbul", ["module-resolver", { "root": ["./src/"] }]]
|
|
},
|
|
"testCompiled": {
|
|
- "plugins": [
|
|
- ["module-resolver", { "root": ["./lib/"] }],
|
|
- ]
|
|
+ "plugins": [["module-resolver", { "root": ["./lib/"] }]]
|
|
}
|
|
}
|
|
}
|
|
diff --git a/.eslintrc b/.eslintrc
|
|
deleted file mode 100644
|
|
index 3c9c658f..00000000
|
|
--- a/.eslintrc
|
|
+++ /dev/null
|
|
@@ -1,248 +0,0 @@
|
|
-{
|
|
- "root": true,
|
|
- "plugins": [
|
|
- "eslint-plugin",
|
|
- "import",
|
|
- ],
|
|
- "extends": [
|
|
- "eslint:recommended",
|
|
- "plugin:eslint-plugin/recommended",
|
|
- "plugin:import/recommended",
|
|
- ],
|
|
- "env": {
|
|
- "node": true,
|
|
- "es6": true,
|
|
- "es2017": true,
|
|
- },
|
|
- "parserOptions": {
|
|
- "sourceType": "module",
|
|
- "ecmaVersion": 2020,
|
|
- },
|
|
- "rules": {
|
|
- "array-bracket-spacing": [2, "never"],
|
|
- "arrow-body-style": [2, "as-needed"],
|
|
- "arrow-parens": [2, "always"],
|
|
- "arrow-spacing": [2, { "before": true, "after": true }],
|
|
- "block-spacing": [2, "always"],
|
|
- "brace-style": [2, "1tbs", { "allowSingleLine": true }],
|
|
- "comma-dangle": ["error", {
|
|
- "arrays": "always-multiline",
|
|
- "objects": "always-multiline",
|
|
- "imports": "always-multiline",
|
|
- "exports": "always-multiline",
|
|
- "functions": "always-multiline",
|
|
- }],
|
|
- "comma-spacing": [2, { "before": false, "after": true }],
|
|
- "comma-style": [2, "last"],
|
|
- "computed-property-spacing": [2, "never"],
|
|
- "curly": [2, "all"],
|
|
- "default-case": [2, { "commentPattern": "(?:)" }],
|
|
- "default-case-last": [2],
|
|
- "default-param-last": [2],
|
|
- "dot-location": [2, "property"],
|
|
- "dot-notation": [2, { "allowKeywords": true, "allowPattern": "throws" }],
|
|
- "eol-last": [2, "always"],
|
|
- "eqeqeq": [2, "allow-null"],
|
|
- "for-direction": [2],
|
|
- "function-call-argument-newline": [2, "consistent"],
|
|
- "func-call-spacing": [2, "never"],
|
|
- "implicit-arrow-linebreak": [2, "beside"],
|
|
- "indent": [2, 2, {
|
|
- "SwitchCase": 1,
|
|
- "VariableDeclarator": 1,
|
|
- "outerIIFEBody": 1,
|
|
- "FunctionDeclaration": {
|
|
- "parameters": 1,
|
|
- "body": 1
|
|
- },
|
|
- "FunctionExpression": {
|
|
- "parameters": 1,
|
|
- "body": 1
|
|
- },
|
|
- "CallExpression": {
|
|
- "arguments": 1
|
|
- },
|
|
- "ArrayExpression": 1,
|
|
- "ObjectExpression": 1,
|
|
- "ImportDeclaration": 1,
|
|
- "flatTernaryExpressions": false,
|
|
- }],
|
|
- "jsx-quotes": [2, "prefer-double"],
|
|
- "key-spacing": [2, {
|
|
- "beforeColon": false,
|
|
- "afterColon": true,
|
|
- "mode": "strict",
|
|
- }],
|
|
- "keyword-spacing": ["error", {
|
|
- "before": true,
|
|
- "after": true,
|
|
- "overrides": {
|
|
- "return": { "after": true },
|
|
- "throw": { "after": true },
|
|
- "case": { "after": true }
|
|
- }
|
|
- }],
|
|
- "linebreak-style": [2, "unix"],
|
|
- "lines-around-directive": [2, {
|
|
- "before": "always",
|
|
- "after": "always",
|
|
- }],
|
|
- "max-len": 0,
|
|
- "new-parens": 2,
|
|
- "no-array-constructor": 2,
|
|
- "no-compare-neg-zero": 2,
|
|
- "no-cond-assign": [2, "always"],
|
|
- "no-extra-parens": 2,
|
|
- "no-multiple-empty-lines": [2, { "max": 1, "maxEOF": 1, "maxBOF": 0 }],
|
|
- "no-return-assign": [2, "always"],
|
|
- "no-trailing-spaces": 2,
|
|
- "no-var": 2,
|
|
- "object-curly-spacing": [2, "always"],
|
|
- "object-shorthand": ["error", "always", {
|
|
- "ignoreConstructors": false,
|
|
- "avoidQuotes": false,
|
|
- "avoidExplicitReturnArrows": true,
|
|
- }],
|
|
- "one-var": [2, "never"],
|
|
- "operator-linebreak": [2, "none", {
|
|
- "overrides": {
|
|
- "?": "before",
|
|
- ":": "before",
|
|
- "&&": "before",
|
|
- "||": "before",
|
|
- },
|
|
- }],
|
|
- "prefer-const": 2,
|
|
- "prefer-object-spread": 2,
|
|
- "prefer-rest-params": 2,
|
|
- "prefer-template": 2,
|
|
- "quote-props": [2, "as-needed", { "keywords": false }],
|
|
- "quotes": [2, "single", {
|
|
- "allowTemplateLiterals": true,
|
|
- "avoidEscape": true,
|
|
- }],
|
|
- "rest-spread-spacing": [2, "never"],
|
|
- "semi": [2, "always"],
|
|
- "semi-spacing": [2, { "before": false, "after": true }],
|
|
- "semi-style": [2, "last"],
|
|
- "space-before-blocks": [2, { "functions": "always", "keywords": "always", "classes": "always" }],
|
|
- "space-before-function-paren": ["error", {
|
|
- "anonymous": "always",
|
|
- "named": "never",
|
|
- "asyncArrow": "always",
|
|
- }],
|
|
- "space-in-parens": [2, "never"],
|
|
- "space-infix-ops": [2],
|
|
- "space-unary-ops": [2, { "words": true, "nonwords": false }],
|
|
- "switch-colon-spacing": [2, { "after": true, "before": false }],
|
|
- "template-curly-spacing": [2, "never"],
|
|
- "template-tag-spacing": [2, "never"],
|
|
- "unicode-bom": [2, "never"],
|
|
- "use-isnan": [2, { "enforceForSwitchCase": true }],
|
|
- "valid-typeof": [2],
|
|
- "wrap-iife": [2, "outside", { "functionPrototypeMethods": true }],
|
|
- "wrap-regex": [2],
|
|
- "yield-star-spacing": [2, { "before": false, "after": true }],
|
|
- "yoda": [2, "never", { "exceptRange": true, "onlyEquality": false }],
|
|
-
|
|
- "eslint-plugin/consistent-output": [
|
|
- "error",
|
|
- "always",
|
|
- ],
|
|
- "eslint-plugin/meta-property-ordering": "error",
|
|
- "eslint-plugin/no-deprecated-context-methods": "error",
|
|
- "eslint-plugin/no-deprecated-report-api": "off",
|
|
- "eslint-plugin/prefer-replace-text": "error",
|
|
- "eslint-plugin/report-message-format": "error",
|
|
- "eslint-plugin/require-meta-docs-description": ["error", { "pattern": "^(Enforce|Ensure|Prefer|Forbid).+\\.$" }],
|
|
- "eslint-plugin/require-meta-schema": "error",
|
|
- "eslint-plugin/require-meta-type": "error",
|
|
-
|
|
- // dog fooding
|
|
- "import/no-extraneous-dependencies": ["error", {
|
|
- "devDependencies": [
|
|
- "tests/**",
|
|
- "resolvers/*/test/**",
|
|
- "scripts/**"
|
|
- ],
|
|
- "optionalDependencies": false,
|
|
- "peerDependencies": true,
|
|
- "bundledDependencies": false,
|
|
- }],
|
|
- "import/unambiguous": "off",
|
|
- },
|
|
-
|
|
- "settings": {
|
|
- "import/resolver": {
|
|
- "node": {
|
|
- "paths": [
|
|
- "src",
|
|
- ],
|
|
- },
|
|
- },
|
|
- },
|
|
-
|
|
- "overrides": [
|
|
- {
|
|
- "files": "scripts/**",
|
|
- "rules": {
|
|
- "no-console": "off",
|
|
- },
|
|
- },
|
|
- {
|
|
- "files": [
|
|
- "resolvers/**",
|
|
- "utils/**",
|
|
- ],
|
|
- "env": {
|
|
- "es6": false,
|
|
- },
|
|
- "parserOptions": {
|
|
- "sourceType": "module",
|
|
- "ecmaVersion": 2016,
|
|
- },
|
|
- "rules": {
|
|
- "comma-dangle": ["error", {
|
|
- "arrays": "always-multiline",
|
|
- "objects": "always-multiline",
|
|
- "imports": "always-multiline",
|
|
- "exports": "always-multiline",
|
|
- "functions": "never"
|
|
- }],
|
|
- "prefer-destructuring": "warn",
|
|
- "prefer-object-spread": "off",
|
|
- "prefer-rest-params": "off",
|
|
- "prefer-spread": "warn",
|
|
- "prefer-template": "off",
|
|
- }
|
|
- },
|
|
- {
|
|
- "files": [
|
|
- "resolvers/webpack/**",
|
|
- "utils/**",
|
|
- ],
|
|
- "rules": {
|
|
- "no-console": 1,
|
|
- },
|
|
- },
|
|
- {
|
|
- "files": [
|
|
- "resolvers/*/test/**/*",
|
|
- ],
|
|
- "env": {
|
|
- "mocha": true,
|
|
- "es6": false
|
|
- },
|
|
- },
|
|
- {
|
|
- "files": "tests/**",
|
|
- "env": {
|
|
- "mocha": true,
|
|
- },
|
|
- "rules": {
|
|
- "max-len": 0,
|
|
- "import/default": 0,
|
|
- },
|
|
- },
|
|
- ],
|
|
-}
|
|
diff --git a/config/electron.js b/config/electron.js
|
|
index f98ff061..0f3aa51d 100644
|
|
--- a/config/electron.js
|
|
+++ b/config/electron.js
|
|
@@ -1,7 +1,7 @@
|
|
/**
|
|
* Default settings for Electron applications.
|
|
*/
|
|
-module.exports = {
|
|
+export default {
|
|
settings: {
|
|
'import/core-modules': ['electron'],
|
|
},
|
|
diff --git a/config/errors.js b/config/errors.js
|
|
index 127c29a0..b46a4c0b 100644
|
|
--- a/config/errors.js
|
|
+++ b/config/errors.js
|
|
@@ -1,9 +1,8 @@
|
|
/**
|
|
* unopinionated config. just the things that are necessarily runtime errors
|
|
* waiting to happen.
|
|
- * @type {Object}
|
|
*/
|
|
-module.exports = {
|
|
+export default {
|
|
plugins: ['import'],
|
|
rules: { 'import/no-unresolved': 2,
|
|
'import/named': 2,
|
|
diff --git a/config/react-native.js b/config/react-native.js
|
|
index a1aa0ee5..97bdf0cf 100644
|
|
--- a/config/react-native.js
|
|
+++ b/config/react-native.js
|
|
@@ -1,7 +1,7 @@
|
|
/**
|
|
* - adds platform extensions to Node resolver
|
|
*/
|
|
-module.exports = {
|
|
+export default {
|
|
settings: {
|
|
'import/resolver': {
|
|
node: {
|
|
diff --git a/config/react.js b/config/react.js
|
|
index 68555512..8e090a83 100644
|
|
--- a/config/react.js
|
|
+++ b/config/react.js
|
|
@@ -5,7 +5,7 @@
|
|
* define jsnext:main and have JSX internally, you may run into problems
|
|
* if you don't enable these settings at the top level.
|
|
*/
|
|
-module.exports = {
|
|
+export default {
|
|
|
|
settings: {
|
|
'import/extensions': ['.js', '.jsx'],
|
|
diff --git a/config/recommended.js b/config/recommended.js
|
|
index 8e7ca9fd..9ced8146 100644
|
|
--- a/config/recommended.js
|
|
+++ b/config/recommended.js
|
|
@@ -1,8 +1,7 @@
|
|
/**
|
|
* The basics.
|
|
- * @type {Object}
|
|
*/
|
|
-module.exports = {
|
|
+export default {
|
|
plugins: ['import'],
|
|
|
|
rules: {
|
|
diff --git a/config/stage-0.js b/config/stage-0.js
|
|
index 42419123..01ebeeb8 100644
|
|
--- a/config/stage-0.js
|
|
+++ b/config/stage-0.js
|
|
@@ -2,9 +2,8 @@
|
|
* Rules in progress.
|
|
*
|
|
* Do not expect these to adhere to semver across releases.
|
|
- * @type {Object}
|
|
*/
|
|
-module.exports = {
|
|
+export default {
|
|
plugins: ['import'],
|
|
rules: {
|
|
'import/no-deprecated': 1,
|
|
diff --git a/config/typescript.js b/config/typescript.js
|
|
index ff7d0795..8904a992 100644
|
|
--- a/config/typescript.js
|
|
+++ b/config/typescript.js
|
|
@@ -11,7 +11,7 @@ const typeScriptExtensions = ['.ts', '.cts', '.mts', '.tsx'];
|
|
|
|
const allExtensions = [...typeScriptExtensions, '.js', '.jsx'];
|
|
|
|
-module.exports = {
|
|
+export default {
|
|
settings: {
|
|
'import/extensions': allExtensions,
|
|
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
|
|
diff --git a/config/warnings.js b/config/warnings.js
|
|
index 5d74143b..ffa27d8d 100644
|
|
--- a/config/warnings.js
|
|
+++ b/config/warnings.js
|
|
@@ -1,8 +1,7 @@
|
|
/**
|
|
* more opinionated config.
|
|
- * @type {Object}
|
|
*/
|
|
-module.exports = {
|
|
+export default {
|
|
plugins: ['import'],
|
|
rules: {
|
|
'import/no-named-as-default': 1,
|
|
diff --git a/scripts/resolverDirectories.js b/scripts/resolverDirectories.js
|
|
index f0c03a3c..a7cadb55 100644
|
|
--- a/scripts/resolverDirectories.js
|
|
+++ b/scripts/resolverDirectories.js
|
|
@@ -1,3 +1,3 @@
|
|
-import glob from 'glob';
|
|
+import { globSync } from 'glob';
|
|
|
|
-export default glob.sync('./resolvers/*/');
|
|
+export default globSync('./resolvers/*/');
|
|
diff --git a/src/docsUrl.js b/src/docsUrl.js
|
|
index 92b838c0..ccb13ba0 100644
|
|
--- a/src/docsUrl.js
|
|
+++ b/src/docsUrl.js
|
|
@@ -1,7 +1,7 @@
|
|
-import pkg from '../package.json';
|
|
+import { version } from '../package.json';
|
|
|
|
const repoUrl = 'https://github.com/import-js/eslint-plugin-import';
|
|
|
|
-export default function docsUrl(ruleName, commitish = `v${pkg.version}`) {
|
|
+export default function docsUrl(ruleName, commitish = `v${version}`) {
|
|
return `${repoUrl}/blob/${commitish}/docs/rules/${ruleName}.md`;
|
|
}
|
|
diff --git a/src/index.js b/src/index.js
|
|
index feafba90..9a464041 100644
|
|
--- a/src/index.js
|
|
+++ b/src/index.js
|
|
@@ -1,71 +1,135 @@
|
|
-export const rules = {
|
|
- 'no-unresolved': require('./rules/no-unresolved'),
|
|
- named: require('./rules/named'),
|
|
- default: require('./rules/default'),
|
|
- namespace: require('./rules/namespace'),
|
|
- 'no-namespace': require('./rules/no-namespace'),
|
|
- export: require('./rules/export'),
|
|
- 'no-mutable-exports': require('./rules/no-mutable-exports'),
|
|
- extensions: require('./rules/extensions'),
|
|
- 'no-restricted-paths': require('./rules/no-restricted-paths'),
|
|
- 'no-internal-modules': require('./rules/no-internal-modules'),
|
|
- 'group-exports': require('./rules/group-exports'),
|
|
- 'no-relative-packages': require('./rules/no-relative-packages'),
|
|
- 'no-relative-parent-imports': require('./rules/no-relative-parent-imports'),
|
|
- 'consistent-type-specifier-style': require('./rules/consistent-type-specifier-style'),
|
|
+/* eslint-disable spaced-comment */
|
|
+import noUnresolved from './rules/no-unresolved';
|
|
+import named from './rules/named';
|
|
+import defaultRule from './rules/default';
|
|
+import namespace from './rules/namespace';
|
|
+import noNamespace from './rules/no-namespace';
|
|
+import exportRule from './rules/export';
|
|
+import noMutableExports from './rules/no-mutable-exports';
|
|
+import extensions from './rules/extensions';
|
|
+import noRestrictedPaths from './rules/no-restricted-paths';
|
|
+import noInternalModules from './rules/no-internal-modules';
|
|
+import groupExports from './rules/group-exports';
|
|
+import noRelativePackages from './rules/no-relative-packages';
|
|
+import noRelativeParentImports from './rules/no-relative-parent-imports';
|
|
+import consistentTypeSpecifierStyle from './rules/consistent-type-specifier-style';
|
|
+import noSelfImport from './rules/no-self-import';
|
|
+import noCycle from './rules/no-cycle';
|
|
+import noNamedDefault from './rules/no-named-default';
|
|
+import noNamedAsDefault from './rules/no-named-as-default';
|
|
+import noNamedAsDefaultMember from './rules/no-named-as-default-member';
|
|
+import noAnonymousDefaultExport from './rules/no-anonymous-default-export';
|
|
+import noUnusedModules from './rules/no-unused-modules';
|
|
+import noCommonjs from './rules/no-commonjs';
|
|
+import noAmd from './rules/no-amd';
|
|
+import noDuplicates from './rules/no-duplicates';
|
|
+import first from './rules/first';
|
|
+import maxDependencies from './rules/max-dependencies';
|
|
+import noExtraneousDependencies from './rules/no-extraneous-dependencies';
|
|
+import noAbsolutePath from './rules/no-absolute-path';
|
|
+import noNodejsModules from './rules/no-nodejs-modules';
|
|
+import noWebpackLoaderSyntax from './rules/no-webpack-loader-syntax';
|
|
+import order from './rules/order';
|
|
+import newlineAfterImport from './rules/newline-after-import';
|
|
+import preferDefaultExport from './rules/prefer-default-export';
|
|
+import noDefaultExport from './rules/no-default-export';
|
|
+import noNamedExport from './rules/no-named-export';
|
|
+import noDynamicRequire from './rules/no-dynamic-require';
|
|
+import unambiguous from './rules/unambiguous';
|
|
+import noUnassignedImport from './rules/no-unassigned-import';
|
|
+import noUselessPathSegments from './rules/no-useless-path-segments';
|
|
+import dynamicImportChunkname from './rules/dynamic-import-chunkname';
|
|
+import noImportModuleExports from './rules/no-import-module-exports';
|
|
+import noEmptyNamedBlocks from './rules/no-empty-named-blocks';
|
|
+import exportsLast from './rules/exports-last';
|
|
+import noDeprecated from './rules/no-deprecated';
|
|
+import importsFirst from './rules/imports-first';
|
|
+import recommended from '../config/recommended';
|
|
+import errors from '../config/errors';
|
|
+import warnings from '../config/warnings';
|
|
+import stage0 from '../config/stage-0';
|
|
+import react from '../config/react';
|
|
+import reactNative from '../config/react-native';
|
|
+import electron from '../config/electron';
|
|
+import typescript from '../config/typescript';
|
|
|
|
- 'no-self-import': require('./rules/no-self-import'),
|
|
- 'no-cycle': require('./rules/no-cycle'),
|
|
- 'no-named-default': require('./rules/no-named-default'),
|
|
- 'no-named-as-default': require('./rules/no-named-as-default'),
|
|
- 'no-named-as-default-member': require('./rules/no-named-as-default-member'),
|
|
- 'no-anonymous-default-export': require('./rules/no-anonymous-default-export'),
|
|
- 'no-unused-modules': require('./rules/no-unused-modules'),
|
|
+/**
|
|
+ * @type {Readonly<import('eslint').Linter.RulesRecord>}
|
|
+ */
|
|
+export const rules = /*#__PURE__*/ kebabCase({
|
|
+ noUnresolved,
|
|
+ named,
|
|
+ default: defaultRule,
|
|
+ namespace,
|
|
+ noNamespace,
|
|
+ export: exportRule,
|
|
+ noMutableExports,
|
|
+ extensions,
|
|
+ noRestrictedPaths,
|
|
+ noInternalModules,
|
|
+ groupExports,
|
|
+ noRelativePackages,
|
|
+ noRelativeParentImports,
|
|
+ consistentTypeSpecifierStyle,
|
|
|
|
- 'no-commonjs': require('./rules/no-commonjs'),
|
|
- 'no-amd': require('./rules/no-amd'),
|
|
- 'no-duplicates': require('./rules/no-duplicates'),
|
|
- first: require('./rules/first'),
|
|
- 'max-dependencies': require('./rules/max-dependencies'),
|
|
- 'no-extraneous-dependencies': require('./rules/no-extraneous-dependencies'),
|
|
- 'no-absolute-path': require('./rules/no-absolute-path'),
|
|
- 'no-nodejs-modules': require('./rules/no-nodejs-modules'),
|
|
- 'no-webpack-loader-syntax': require('./rules/no-webpack-loader-syntax'),
|
|
- order: require('./rules/order'),
|
|
- 'newline-after-import': require('./rules/newline-after-import'),
|
|
- 'prefer-default-export': require('./rules/prefer-default-export'),
|
|
- 'no-default-export': require('./rules/no-default-export'),
|
|
- 'no-named-export': require('./rules/no-named-export'),
|
|
- 'no-dynamic-require': require('./rules/no-dynamic-require'),
|
|
- unambiguous: require('./rules/unambiguous'),
|
|
- 'no-unassigned-import': require('./rules/no-unassigned-import'),
|
|
- 'no-useless-path-segments': require('./rules/no-useless-path-segments'),
|
|
- 'dynamic-import-chunkname': require('./rules/dynamic-import-chunkname'),
|
|
- 'no-import-module-exports': require('./rules/no-import-module-exports'),
|
|
- 'no-empty-named-blocks': require('./rules/no-empty-named-blocks'),
|
|
+ noSelfImport,
|
|
+ noCycle,
|
|
+ noNamedDefault,
|
|
+ noNamedAsDefault,
|
|
+ noNamedAsDefaultMember,
|
|
+ noAnonymousDefaultExport,
|
|
+ noUnusedModules,
|
|
+
|
|
+ noCommonjs,
|
|
+ noAmd,
|
|
+ noDuplicates,
|
|
+ first,
|
|
+ maxDependencies,
|
|
+ noExtraneousDependencies,
|
|
+ noAbsolutePath,
|
|
+ noNodejsModules,
|
|
+ noWebpackLoaderSyntax,
|
|
+ order,
|
|
+ newlineAfterImport,
|
|
+ preferDefaultExport,
|
|
+ noDefaultExport,
|
|
+ noNamedExport,
|
|
+ noDynamicRequire,
|
|
+ unambiguous,
|
|
+ noUnassignedImport,
|
|
+ noUselessPathSegments,
|
|
+ dynamicImportChunkname,
|
|
+ noImportModuleExports,
|
|
+ noEmptyNamedBlocks,
|
|
|
|
// export
|
|
- 'exports-last': require('./rules/exports-last'),
|
|
+ exportsLast,
|
|
|
|
// metadata-based
|
|
- 'no-deprecated': require('./rules/no-deprecated'),
|
|
+ noDeprecated,
|
|
|
|
// deprecated aliases to rules
|
|
- 'imports-first': require('./rules/imports-first'),
|
|
-};
|
|
+ importsFirst,
|
|
+});
|
|
|
|
export const configs = {
|
|
- recommended: require('../config/recommended'),
|
|
+ recommended,
|
|
|
|
- errors: require('../config/errors'),
|
|
- warnings: require('../config/warnings'),
|
|
+ errors,
|
|
+ warnings,
|
|
|
|
// shhhh... work in progress "secret" rules
|
|
- 'stage-0': require('../config/stage-0'),
|
|
+ 'stage-0': stage0,
|
|
|
|
// useful stuff for folks using various environments
|
|
- react: require('../config/react'),
|
|
- 'react-native': require('../config/react-native'),
|
|
- electron: require('../config/electron'),
|
|
- typescript: require('../config/typescript'),
|
|
+ react,
|
|
+ 'react-native': reactNative,
|
|
+ electron,
|
|
+ typescript,
|
|
};
|
|
+
|
|
+function kebabCase(obj) {
|
|
+ return Object.fromEntries(
|
|
+ Object.entries(obj).map(([key, value]) => [key.replace(/([A-Z])/g, '-$1').toLowerCase(), value])
|
|
+ )
|
|
+}
|
|
\ No newline at end of file
|
|
diff --git a/src/rules/imports-first.js b/src/rules/imports-first.js
|
|
index 966367e9..3881d383 100644
|
|
--- a/src/rules/imports-first.js
|
|
+++ b/src/rules/imports-first.js
|
|
@@ -1,6 +1,6 @@
|
|
import docsUrl from '../docsUrl';
|
|
|
|
-const first = require('./first');
|
|
+import first from './first';
|
|
|
|
const newMeta = {
|
|
...first.meta,
|