🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis β†’
Socket
Book a DemoInstallSign in
Socket

@lintest/cli

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lintest/cli

Integrated lint and test environment project

latest
release
Source
npmnpm
Version
3.18.4
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
Β 
Created
Source

Lintest CLI

npm node types downloads license

Copyright 2024. mornya. All rights reserved.

About

Integrated lint and test environment project.

Features

  • TypeScript and ES6+ support.
  • Linting TypeScript / JavaScript codes with ESLint.
  • Testing codes with Jest.
  • Availabled for Node.js / React.js (Next.js) / Vue.js (Nuxt.js) applications.

Installation

ν•΄λ‹Ή λΌμ΄λΈŒλŸ¬λ¦¬λŠ” κΈ€λ‘œλ²Œ μ˜μ—­μ— μ„€μΉ˜ν•œλ‹€.

npm λŒ€μ‹  yarn μ‚¬μš©μ‹œ, ν”„λ‘œμ νŠΈ 루트 κ²½λ‘œμ— package-lock.json 파일이 μ‘΄μž¬ν•˜λ©΄ μ œκ±°ν•˜κ³  yarn.lock 파일만 μ°Έμ‘°λ˜λ„λ‘ ν•œλ‹€.

$ npm install -g @lintest/cli
or
$ yarn global add @lintest/cli

Execution

Commands

$ lintest <action> [option]

μ‚¬μš©κ°€λŠ₯ν•œ action은 μ•„λž˜μ™€ κ°™λ‹€.

  • install: 린트 λ£°μ…‹ νŒ¨ν‚€μ§€ μ„€μΉ˜ 및 lintest 정보 생성, λͺ¨λ“ˆ μ—…κ·Έλ ˆμ΄λ“œ λ“± μˆ˜ν–‰
  • uninstall: μƒμ„±λœ 정보 및 λ³΅μ‚¬λœ 파일 λ“± install/export μˆ˜ν–‰μ— λ”°λ₯Έ κ΄€λ ¨ 파일 제거
  • export: 린트 및 ν…ŒμŠ€νŠΈ ν™˜κ²½μ„€μ • λ‚΄μš©μ„ JSON 파일둜 좜λ ₯ν•˜μ—¬ IDEμ—μ„œ 섀정이 μ°Έμ‘°λ˜λ„λ‘ 함
  • check: TypeScript 컴파일러λ₯Ό μ‹€ν–‰μ‹œμΌœ ν”„λ‘œμ νŠΈ λ‚΄ μ½”λ“œ 였λ₯˜ 검사 μˆ˜ν–‰
  • clean: 기본적으둜 dist 및 node_modules/.cache λ””λ ‰ν† λ¦¬μ˜ λ‚΄μš©μ„ λΉ„μš°μ§€λ§Œ, νŒŒλΌλ―Έν„°λ‘œ μΈμž…λœ 디렉토리(λ“€)이 μ‘΄μž¬μ‹œ ν•΄λ‹Ή λ””λ ‰ν† λ¦¬μ˜ λ‚΄μš©μ„ 비움
  • lint: ν”„λ‘œμ νŠΈ λ‚΄ μ½”λ“œμ— λŒ€ν•œ 린트 μˆ˜ν–‰
  • test: ν”„λ‘œμ νŠΈ λ‚΄ ν…ŒμŠ€νŠΈ μ½”λ“œμ— λŒ€ν•œ ν…ŒμŠ€νŠΈμΌ€μ΄μŠ€ μˆ˜ν–‰
  • list: κΈ°λ³Έ ESLint ν”ŒλŸ¬κ·ΈμΈκ³Ό μΆ”κ°€μ μœΌλ‘œ μ„€μΉ˜λœ ν”ŒλŸ¬κ·ΈμΈ λͺ©λ‘μ„ ν‘œμ‹œ
  • help: 각 μ•‘μ…˜μ— λŒ€ν•œ 도움말 ν‘œμ‹œ

μ˜΅μ…˜μ— λŒ€ν•œ 도움말은 μ•„λž˜μ™€ 같이 μ»€λ§¨λ“œλ₯Ό μž…λ ₯ν•˜μ—¬ ν™•μΈν•œλ‹€.

# μ•‘μ…˜ μ»€λ§¨λ“œ 도움말
$ lintest --help

# μ•‘μ…˜μ— λŒ€ν•œ μ˜΅μ…˜ μ»€λ§¨λ“œ 도움말
$ lintest help [lint|test|...]

CLI

lintest ν™˜κ²½μ„€μ •μ€ ν”„λ‘œμ νŠΈ 루트 κ²½λ‘œμ— lintest.config.js ν˜Ήμ€ lintest.config.json λ“±μ˜ 파일둜 μƒμ„±ν•˜λ©΄ λœλ‹€.
lintest μ‹€ν–‰μ‹œ ν”„λ‘œμ νŠΈμ— ν•΄λ‹Ή μ„€μ • 파일이 μ‘΄μž¬ν•˜λ©΄ lintest install λͺ…령을 μˆ˜ν–‰ν•  λ•Œ providerν•­λͺ©μœΌλ‘œ μ§€μ •λœ λ£°μ…‹ νŒ¨ν‚€μ§€κ°€ NPM κΈ€λ‘œλ²Œ μ˜μ—­μ— μ„€μΉ˜(μ—…λ°μ΄νŠΈ) 되며, 린트 룰셋은 ν•΄λ‹Ή νŒ¨ν‚€μ§€ λ‚΄ 섀정에 λ”°λ₯΄κ²Œ λœλ‹€.

// lintest.config.js

module.exports = {
  provider: 'sample', // required

  // If your project uses the Next.js or Nuxt.js framework,
  // specify it to avoid plugin confusion when doing ESLint.
  framework: 'next', // or 'nuxt'

  // optionals below
  exportConfig: {
    lint: 'eslint.config.json', // export ESLint config to filename (related project path)
    test: 'jest.config.json', // export Jest config to filename
    prettier: '.prettierrc', // export Prettier config to filename (if prettier configured)
  },

  // set location of the cache file or directory
  cacheLocation: {
    lint: '.eslintcache', // default: node_modules/.cache/lintest/eslintcache
    test: '.jestcache', // default: node_modules/.cache/lintest/jestcache
  },

  // You can customize with additional ESLint plugins by overriding options
  installPlugins: [
    'eslint-plugin-something@latest',
    'eslint-plugin-simple-import-sort',
  ],
  // Also can customize with additional Jest environments
  // and give an option "--env" to test that environment
  installEnvironments: [
    'jest-environment-selenium',
  ],

  // Override and customize
  overrides: {
    lintRules: { ... }, // overriding provider's lint rules
    eslint: [ // just same as ESLint "overrides" option
      {
        // the samples for using simple-import-sort plugin
        files: '*.vue',
        plugins: ['eslint-plugin-simple-import-sort'],
        rules: {
          'simple-import-sort/imports': 'error',
          'simple-import-sort/exports': 'error',
        },
      },
    ],
    jest: {
      bail: false,
      // ("testURL" option has been replaced as shown below) 
      testEnvironmentOptions: {
        url: 'https://localhost:8443'
      },
      ...
    },
  }
}

μœ„μ™€ 같이 μ„€μ •ν•˜λ©΄ lintest install λͺ…λ Ή μ‹€ν–‰μ‹œ @lintest/rules-sample νŒ¨ν‚€μ§€κ°€ κΈ€λ‘œλ²Œ μ˜μ—­μ— μ„€μΉ˜κ°€ 되며 ν”„λ‘œμ νŠΈμ˜ 린트 룰셋은 ν•΄λ‹Ή νŒ¨ν‚€μ§€μ— μ„ μ–Έλœ 섀정을 λ”°λ₯Έλ‹€.
그리고 lintest export λͺ…λ Ή μ‹€ν–‰μ‹œ exportConfig에 μ„ μ–Έλœ νŒŒμΌλ“€λ‘œ ESLint λ£°μ…‹κ³Ό Jest, Prettier 섀정이 좜λ ₯λœλ‹€.

rules λ””νŽœλ˜μ‹œ 생성은 μ•„λž˜μ—μ„œ 닀룬닀.

린트 및 ν…ŒμŠ€νŠΈ μˆ˜ν–‰μ€ CLI둜 μ‹€ν–‰ν•˜λ©°, μ»€λ§¨λ“œλΌμΈμ—μ„œ μ•„λž˜μ™€ 같이 μ‹€ν–‰ ν•  수 μžˆλ‹€.

# 린트 μ‹€ν–‰μ‹œ
$ lintest lint [--fix][--debug][--no-cache][...]

# ν…ŒμŠ€νŠΈ μ‹€ν–‰μ‹œ
$ lintest test [--coverage][--watch][--debug][--no-cache][...]

린트 및 ν…ŒμŠ€νŠΈ ν™˜κ²½μ„€μ • λ‚΄μš©μ΄ ν•„μš”ν•  경우 export λͺ…령을 μ‚¬μš©ν•˜μ—¬ ν™˜κ²½μ„€μ •μ„ μ°Έκ³ ν•  수 μžˆλ‹€.
μˆ˜ν–‰κ²°κ³ΌλŠ” ν”„λ‘œμ νŠΈ 루트 κ²½λ‘œμ— ESLint ν™˜κ²½μ„€μ • 파일 및 Jest ν™˜κ²½μ„€μ • 파일이 좜λ ₯λœλ‹€ (lintest.config νŒŒμΌμ—μ„œ μ§€μ •ν•œ 파일경둜둜 λ³€κ²½ κ°€λŠ₯).
λ§Œμ•½ 정상적인 좜λ ₯이 λ˜μ§€ μ•ŠλŠ”λ‹€λ©΄ debug νŒŒλΌλ―Έν„°λ‘œ ν™•μΈν•œλ‹€.

$ lintest export [--debug]

NPM

NPM ν”„λ‘œμ νŠΈμ—μ„œλŠ” npm run λͺ…λ ΉμœΌλ‘œ μ‹€ν–‰λ˜λ„λ‘ μ•„λž˜μ™€ 같이 package.json 파일 내에 μ„€μ •ν•œλ‹€.

{
  "scripts": {
    "check": "lintest check",
    "clean": "lintest clean",
    "lint": "lintest lint",
    "lint:fix": "lintest lint --fix",
    "lint:debug": "lintest lint --debug --no-cache",
    "test": "lintest test",
    "test:watch": "lintest test --watch",
    "test:coverage": "lintest test --coverage --no-cache"
  }
}

ν”„λ‘œμ νŠΈμ—μ„œ npm install λͺ…령이 μ‹€ν–‰λœ 후에 lintest μ—…λ°μ΄νŠΈ 및 λ£° μ—…λ°μ΄νŠΈλ₯Ό μžλ™μœΌλ‘œ μˆ˜ν–‰ν•΄ 쀄 수 μžˆλ„λ‘ μ•„λž˜μ™€ 같이 μ„€μ •ν•  μˆ˜λ„ μžˆλ‹€.

  • exit 0은 lintestκ°€ μ„€μΉ˜λ˜μ–΄ μžˆμ§€ μ•Šμ„ 경우, 였λ₯˜λ‘œ 인해 λ‹€μŒ ν”„λ‘œμ„ΈμŠ€κ°€ λ™μž‘ν•˜μ§€ μ•ŠλŠ” 것을 λ°©μ§€ν•˜κΈ° μœ„ν•΄ μ •μƒμ’…λ£Œλ‘œ μ²˜λ¦¬ν•˜λ„λ‘ ν•΄μ€€λ‹€.
  • 둜컬 κ°œλ°œν™˜κ²½μ΄ μ•„λ‹Œ ν…ŒμŠ€νŠΈ/μš΄μ˜ν™˜κ²½μ—μ„œ lintest λ―Έμ„€μΉ˜λ‘œ 인해 였λ₯˜κ°€ λ°œμƒν•˜μ§€ μ•Šλ„λ‘ 주의.
{
  "scripts": {
    "postinstall": "lintest install || exit 0",
    "postuninstall": "lintest install || exit 0",
    "prepare": "lintest export || exit 0"
  }
}

Testing

ν…ŒμŠ€νŠΈμΌ€μ΄μŠ€λ₯Ό μˆ˜ν–‰ν•˜κΈ° μœ„ν•΄ CLI의 λ””νŽœλ˜μ‹œλ‘œ μ„€μΉ˜λœ jest λ°”μ΄λ„ˆλ¦¬κ°€ μ‹€ν–‰λœλ‹€.
ν…ŒμŠ€νŠΈ νŒŒμΌμ€ ν”„λ‘œμ νŠΈ λ‚΄ μ‘΄μž¬ν•˜λŠ” *.{test,spec}.{ts,tsx,js,jsx} νŒŒμΌλ“€μ΄ ν…ŒμŠ€νŠΈ λŒ€μƒμ΄ λœλ‹€.

Setup files

각 λ‹¨μœ„ ν…ŒμŠ€νŠΈλ₯Ό μˆ˜ν–‰ν•˜κΈ° μ „ mocking methodλ‚˜ 초기 섀정을 ν•  수 μžˆλ„λ‘ μ…‹μ—… νŒŒμΌμ„ μΆ”κ°€ ν•  수 μžˆλ‹€. 적용될 ν…ŒμŠ€νŠΈ μ…‹μ—… νŒŒμΌμ€ μ•„λž˜ λͺ©λ‘μ—μ„œ μ‘΄μž¬ν•˜λŠ” νŒŒμΌμ„ λͺ¨λ‘ μ°Ύμ•„ μ‚¬μš©ν•˜κ²Œ λœλ‹€.

μžμ„Έν•œ λ‚΄μš©μ€ Jest κ΄€λ ¨ λ¬Έμ„œλ₯Ό μ°Έκ³ .

<rootDir>/src/test/@setup.ts (or .js|cjs|cts|mjs|mts)
<rootDir>/src/tests/@setup.ts
<rootDir>/test/@setup.ts
<rootDir>/tests/@setup.ts
<rootDir>/test-setup.ts

Test Coverage

μ•„λž˜ λͺ…λ ΉμœΌλ‘œ ν…ŒμŠ€νŠΈ 컀버리지 데이터λ₯Ό ν”„λ‘œμ νŠΈ λ‚΄ /coverage 디렉토리에 생성할 수 μžˆλ‹€.

$ lintest test --coverage

Lint rules package

Naming

νŒ¨ν‚€μ§€λͺ…은 @lintest/rules-{ν”„λ‘œλ°”μ΄λ”λͺ…}으둜 μ •μ˜ν•˜κ³  NPM @lintest 쑰직의 μŠΉμΈμ„ λ°›μ•„ λ°°ν¬ν•¨μœΌλ‘œμ¨ CLIμ—μ„œ ν•΄λ‹Ή νŒ¨ν‚€μ§€λ₯Ό λ°›μ•„ 린트 룰을 적용 ν•  수 있게 λœλ‹€.

Package defination

package.json의 "main"으둜 μ„€μ •λœ 파일(index.js)에 μ•„λž˜μ™€ 같은 단일 ν˜•νƒœμ˜ μ •μ˜ 파일이 기본적으둜 ν•„μš”ν•˜λ‹€.
μ„€μ •κ°€λŠ₯ ν•­λͺ©μ€ prettier, lintRules, disableLintIgnore, enableCompatibility 등이 μžˆλ‹€.

prettier

  • prettier ν•­λͺ©μ€ prettier μ‚¬μš©μ΄ ν•„μš”ν•  λ•Œλ§Œ λͺ…μ‹œν•˜λ©΄ λœλ‹€.

lintRules

μ•„λž˜ μƒ˜ν”Œμ²˜λŸΌ μ„€μ •ν•΄μ£Όλ©΄ lintestμ—μ„œ 섀정에 따라 μ—¬λŸ¬ ν”ŒλŸ¬κ·ΈμΈμ„ μ‘°ν•©ν•˜μ—¬ μ΅œμ’… 린트 룰셋을 λ§Œλ“€μ–΄λ‚Έλ‹€.

  • lintRules ν•˜μœ„ ν•­λͺ©μ˜ 룰에 λŒ€ν•œ 선언은 ν”ŒλŸ¬κ·ΈμΈλ³„ prefixλ₯Ό 뢙이지 μ•Šμ•„λ„ 되며, λΆˆν•„μš”μ‹œ λͺ…μ‹œν•˜μ§€ μ•Šμ•„λ„ λœλ‹€.

    예λ₯Ό λ“€μ–΄, typescript ν•­λͺ©μ˜ '@typescript-eslint/indent' 룰을 μ •μ˜ν•  λ•Œ '@typescript-eslint/'λŠ” ꡳ이 λΆ™μ—¬μ£Όμ§€ μ•Šμ•„λ„ 'typescript' ν•­λͺ© ν•˜μœ„μ— 'indent'만으둜 선언해도 μ΅œμ’… 룰은 '@typescript-eslint/indent'둜 λ³€ν™˜λœλ‹€.

  • lintRules ν•˜μœ„ ν•­λͺ© 쀑 vue ν˜Ήμ€ react 룰이 λͺ…μ‹œλ˜λ©΄ κ΄€λ ¨ 룰셋이 ν•¨κ»˜ μ μš©λœλ‹€.

    vueλŠ” "eslint-plugin-vue", "@vue/standard", "@vue/typescript" λ“± 적용.
    reactλŠ” "eslint-plugin-jsx-a11y", "eslint-plugin-react", "eslint-plugin-react-hooks" λ“± 적용.

  • μ‚¬μš©ν•˜μ§€ μ•Šμ„ 룰은 ν•΄λ‹Ή ν•­λͺ©μ„ μ£Όμ„μ²˜λ¦¬ ν•΄λ‘κ±°λ‚˜ μ‚­μ œν•˜λ©΄ λœλ‹€.

    ex)
    // prettier: 'unused',
    lintRules: {
    Β Β // import: {},
    },

Sample

// index.js

module.exports = {
  // [prettier]
  // - "prettier.overrides"λ₯Ό μ‚¬μš©ν•  수 μ—†μœΌλ―€λ‘œ, .prettierrc νŒŒμΌμ„ μ‚¬μš©ν•  수 μžˆλ„λ‘
  //   μ•„λž˜μ™€ 같이 string ν˜•νƒœλ‘œ μ§€μ •ν•œλ‹€. κ·Έλž˜λ„ eslint-plugin-prettier ν”ŒλŸ¬κ·ΈμΈμ€ μ μš©λœλ‹€.
  //   >> prettier: '.prettierrc',
  prettier: {
    tabWidth: 2,
    useTabs: false,
  },
  lintRules: {
    general: {
      'comma-dangle': 'off',
      'no-console': 'off',
      'no-debugger': 'off',
    },
    typescript: {
      '@typescript-eslint/indent': ['error', 2],
    },
    react: {
      'react/jsx-boolean-value': 'off',
      'jsx-wrap-multilines': 'off', // might be specify no prefix
    },
    reactHooks: {
      'rules-of-hooks': 'error',
      'exhaustive-deps': 'warn',
    },
    next: {
      'no-img-element': 'off',
    },
    vue: {
      'attribute-hyphenation': 'off',
      'vue/html-closing-bracket-spacing': 'off',
      'vue/html-indent': ['error', 2],
      'html-self-closing': 'off',
    },
    nuxt: {
      'nuxt/no-cjs-in-config': 'off',
    },
    unicorn: {
      'escape-case': 'error',
    },
    promise: {
      'promise/valid-params': 'off',
    },
    import: {},
    jest: {},
    lintest: {
      report: [1, 'all', 10, 300], // @lintest/eslint-plugin μ°Έκ³ 
    },
    node: {},
  },

  // disables .eslintignore usage
  disableLintIgnore: false,
  // turns on ESLint parserOptions.createDefaultProgram
  enableCompatibility: false,
}

Etcs

린트 퍼포먼슀 ν–₯상을 μœ„ν•΄ μ•„λž˜μ™€ 같이 performance reportλ₯Ό μ½˜μ†”λ‘œ 좜λ ₯ν•  수 μžˆλ‹€.
λ¦°νŠΈμ‹œ μˆ˜ν–‰μ‹œκ°„μ„ μ²΄ν¬ν•΄λ³΄λ©΄μ„œ μ‹œκ°„μ΄ 많이 κ±Έλ¦¬λŠ” 룰에 λŒ€ν•΄ λΉ„ν™œμ„±ν™”ν•˜λ©΄ μˆ˜ν–‰μ†λ„ ν–₯상에 도움이 λœλ‹€.

$ export TIMING=1
$ npm run lint

Change Log

ν”„λ‘œμ νŠΈ 변경사항은 CHANGELOG.md 파일 μ°Έμ‘°.

License

ν”„λ‘œμ νŠΈ λΌμ΄μ„ΌμŠ€λŠ” LICENSE μ°Έμ‘°.

Keywords

lintest

FAQs

Package last updated on 02 Jul 2025

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