Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@startdt/eslint-config

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@startdt/eslint-config

ESLint 可共享配置

  • 2.7.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@startdt/eslint-config dependencies

open source npm version node version npm peer dependency version npm download npm license

如何使用

npm i eslint @startdt/eslint-config --save-dev

提示:无需在项目中安装 eslint-plugin-vueeslint-config-* 以及其他第三方依赖。

使用配置文件:

// .eslintrc.js
module.exports = {
    extends: '@startdt/eslint-config',
    rules: {
        // 自定义规则
    },
};

或者项目属性:

// package.json
"eslintConfig": {
    "extends": "@startdt/eslint-config",
    "rules": {}
}

@typescript-eslint/eslint-plugin

如需在项目中支持 TypeScript 语法检测,请使用以下配置:

// .eslintrc.js
module.exports = {
    extends: [
        '@startdt/eslint-config',
        '@startdt/eslint-config/typescript',
    ],
    rules: {
        // 自定义规则
    },
};

注意:请确保 eslint --ext .js,.ts 包含目标文件,因为 ESLint 默认仅检测 .js 文件。

eslint-plugin-jest

默认文件匹配规则:

  • 任何 tests/unit 中以 .spec.(js|jsx|ts|tsx) 结尾的文件
  • 任何 __tests__ 目录中的 js(x)/ts(x) 文件
// .eslintrc.js
module.exports = {
    extends: [
        '@startdt/eslint-config',
        '@startdt/eslint-config/plugins/jest',
    ],
    rules: {
        // 自定义规则
    },
};

eslint-plugin-mocha

默认文件匹配规则:

  • 任何任何 tests/unit 中以 .spec.(js|ts) 结尾的文件
// .eslintrc.js
module.exports = {
    extends: [
        '@startdt/eslint-config',
        '@startdt/eslint-config/plugins/mocha',
    ],
    rules: {
        // 自定义规则
    },
};

eslint-plugin-cypress

默认文件匹配规则:

  • 任何 tests/e2e 中以 .spec.(js|ts) 结尾的文件
// .eslintrc.js
module.exports = {
    extends: [
        '@startdt/eslint-config',
        '@startdt/eslint-config/plugins/cypress',
    ],
    rules: {
        // 自定义规则
    },
};

eslint-plugin-import

eslint-import-resolver-lerna

导入解析配置:

// .eslintrc.js
module.exports = {
    extends: [
        '@startdt/eslint-config',
        '@startdt/eslint-config/resolver/lerna',
    ],
    rules: {
        // 自定义规则
    },
};

或者手动配置:

// .eslintrc.js
const path = require('path');

module.exports = {
    extends: '@startdt/eslint-config',
    settings: {
        'import/resolver': {
            lerna: {
                // 必须是 packages 目录的绝对路径,支持 string 或 array
                packages: path.resolve(__dirname, 'src/packages'),
            },
        },
    },
    rules: {
        // 自定义规则
    },
};

eslint-import-resolver-webpack

导入解析配置:

// .eslintrc.js
module.exports = {
    extends: [
        '@startdt/eslint-config',
        '@startdt/eslint-config/resolver/webpack',
    ],
    rules: {
        // 自定义规则
    },
};

或者手动配置:

// .eslintrc.js
module.exports = {
    extends: '@startdt/eslint-config',
    settings: {
        'import/resolver': {
            webpack: {
                // 指向 webpack.config.js 配置文件,支持相对路径或绝对路径
                config: 'node_modules/@vue/cli-service/webpack.config.js',
            },
        },
    },
    rules: {
        // 自定义规则
    },
};

错误级别

  1. 默认情况下,所有启用的规则都是 "error" 级别的严重程度;
  2. 已启用规则,且支持 --fix 选项自动修复的规则都是 "warn" 级别的严重程度;
  3. 未启用规则,默认将值设置为 "off" 进行显式配置,不产生任何错误信息;
  4. 继承的规则,包括插件的规则都遵循以上错误级别;

Keywords

FAQs

Package last updated on 04 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc