UNPKG

@tangany/eslint-config

Version:
144 lines (139 loc) 4.28 kB
import eslintPluginImport from "eslint-plugin-import"; import TSESLint from "typescript-eslint"; export default TSESLint.config( { languageOptions: { ecmaVersion: 6, sourceType: "module", globals: { // You can specify any additional global variables here if needed }, }, plugins: { import: eslintPluginImport, }, settings: { "import/resolver": { node: { extensions: [".mjs", ".js", ".json"], }, }, "import/extensions": [".js", ".mjs", ".ts", ".tsx"], "import/core-modules": [], "import/ignore": [ "node_modules", "\\.(coffee|scss|css|less|hbs|svg|json)$", ], }, rules: { // Static analysis: "import/no-unresolved": ["off", { commonjs: true, caseSensitive: true }], "import/named": "error", "import/default": "off", "import/namespace": "off", // Helpful warnings: "import/export": "error", "import/no-named-as-default": "error", "import/no-named-as-default-member": "error", "import/no-deprecated": "off", "import/no-extraneous-dependencies": [ "off", { devDependencies: [ "test/**", "tests/**", "spec/**", "**/__tests__/**", "**/__mocks__/**", "test.{ts,tsx}", "test-*.{ts,tsx}", "**/*{.,_}{test,spec}.{ts,tsx}", "**/jest.config.js", "**/jest.setup.js", "**/vue.config.js", "**/webpack.config.js", "**/webpack.config.*.js", "**/rollup.config.js", "**/rollup.config.*.js", "**/gulpfile.js", "**/gulpfile.*.js", "**/Gruntfile{,.js}", "**/protractor.conf.js", "**/protractor.conf.*.js", "**/karma.conf.js", "**/.eslintrc.js", ], optionalDependencies: false, }, ], "import/no-mutable-exports": "error", // Module systems: "import/no-commonjs": "off", "import/no-nodejs-modules": "off", // Style guide: "import/first": "error", "import/no-duplicates": "error", "import/no-namespace": "off", "import/extensions": "off", "import/order": [ "off", { groups: [["builtin", "external", "internal"]] }, ], "simple-import-sort/exports": "off", "simple-import-sort/imports": "error", "import/prefer-default-export": "off", "import/no-restricted-paths": "off", "import/max-dependencies": ["off", { max: 10 }], "import/no-absolute-path": "error", "import/no-dynamic-require": "error", "import/no-internal-modules": ["off", { allow: [] }], "import/unambiguous": "off", "import/no-webpack-loader-syntax": "error", "import/no-unassigned-import": "off", "import/no-named-default": "error", "import/no-anonymous-default-export": [ "off", { allowArray: false, allowArrowFunction: false, allowAnonymousClass: false, allowAnonymousFunction: false, allowLiteral: false, allowObject: false, }, ], "import/exports-last": "off", "import/group-exports": "off", "import/no-default-export": "off", "import/no-named-export": "off", "import/no-self-import": "error", "import/no-cycle": ["warn", { maxDepth: "∞" }], "import/no-useless-path-segments": ["error", { commonjs: true }], "import/dynamic-import-chunkname": [ "off", { importFunctions: [], webpackChunknameFormat: "[0-9a-zA-Z-_/.]+", }, ], "import/no-relative-parent-imports": "off", "import/no-unused-modules": [ "off", { ignoreExports: [], missingExports: true, unusedExports: true, }, ], "import/no-import-module-exports": [ "error", { exceptions: [], }, ], "import/no-relative-packages": "error", "import/consistent-type-specifier-style": ["error", "prefer-top-level"], "import/no-empty-named-blocks": "error", }, }, );