๐Ÿšจ 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

Source
npmnpm
Version
2.0.0-beta0
Version published
Maintainers
1
Created
Source

Lintest CLI

npm node NPM
Copyright 2020. mornya. All rights reserved.

About

Integrated lint and test environment project.

Features

  • TypeScript / ES6+ support with TypeScript.
  • Linting TypeScript / JavaScript codes with ESLint.
  • Testing codes with Jest.
  • All available for Node.js / React.js / Vue.js (Nuxt.js) application

Installation

ํ•ด๋‹น ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋Š” ๊ธ€๋กœ๋ฒŒ๋กœ ์„ค์น˜ํ•˜๊ฑฐ๋‚˜ ํ”„๋กœ์ ํŠธ ๋‚ด์— ์„ค์น˜ํ•  ์ˆ˜ ์žˆ๋‹ค.

npm ๋Œ€์‹  yarn ์‚ฌ์šฉ์‹œ, ํ”„๋กœ์ ํŠธ ๋ฃจํŠธ ๊ฒฝ๋กœ์— package-lock.json ํŒŒ์ผ์ด ์กด์žฌํ•˜๋ฉด ์ œ๊ฑฐํ•˜๊ณ  yarn.lock ํŒŒ์ผ๋งŒ ์ฐธ์กฐ๋˜๋„๋ก ํ•œ๋‹ค.

$ npm install --save-dev @lintest/cli
or
$ yarn add -D @lintest/cli

๊ธ€๋กœ๋ฒŒ ์„ค์น˜๋ฅผ ์œ„ํ•ด์„œ๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด ์‹คํ–‰ํ•œ๋‹ค.

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

Execution

CLI

lintest ํ™˜๊ฒฝ์„ค์ •์€ ํ”„๋กœ์ ํŠธ ๋ฃจํŠธ ๊ฒฝ๋กœ์— lintest.config.js ํŒŒ์ผ๋กœ ์ƒ์„ฑํ•˜๋ฉด ๋œ๋‹ค. ํ•ด๋‹น ํŒŒ์ผ์ด ์กด์žฌํ•˜๋ฉด lintest install ๋ช…๋ น ์ˆ˜ํ–‰์‹œ providerํ•ญ๋ชฉ์œผ๋กœ ์ง€์ •๋œ ๋””ํŽœ๋˜์‹œ๊ฐ€ ํ”„๋กœ์ ํŠธ์— ์„ค์น˜๋˜๋ฉฐ, ๋ฆฐํŠธ ๋ฃฐ์€ ํ•ด๋‹น ๋””ํŽœ๋˜์‹œ ์„ค์ •์— ๋”ฐ๋ฅด๊ฒŒ ๋œ๋‹ค.

// lintest.config.js
module.exports = {
  provider: 'sample',
}

์œ„์™€ ๊ฐ™์ด ์„ค์ •ํ•˜๋ฉด lintest install ๋ช…๋ น ์‹คํ–‰์‹œ @lintest/rules-sample ๋””ํŽœ๋˜์‹œ๊ฐ€ ํ”„๋กœ์ ํŠธ ๋‚ด ์„ค์น˜๊ฐ€ ๋˜๋ฉฐ lint rule์€ ํ•ด๋‹น ๋””ํŽœ๋˜์‹œ ๋‚ด ์„ค์ •์„ ๋”ฐ๋ฅธ๋‹ค.

  • rules ๋””ํŽœ๋˜์‹œ ์ƒ์„ฑ์€ ์•„๋ž˜์—์„œ ๋‹ค๋ฃฌ๋‹ค.
  • package.json ํŒŒ์ผ ๋‚ด scripts.postinstall ํ•ญ๋ชฉ์— lintest install์„ ์ถ”๊ฐ€๋กœ ์ง€์ •ํ•˜์—ฌ npm install ๋ช…๋ น์ด ์‹คํ–‰๋  ๋•Œ๋งˆ๋‹ค ํ•ด๋‹น ํ•ญ๋ชฉ์ด ์‹คํ–‰๋  ์ˆ˜ ์žˆ๋„๋ก ์„ค์ •ํ•œ๋‹ค.
    {
      "scripts": {
        "postinstall": "lintest install"
      }
    }
    

๋ฆฐํŠธ ๋ฐ ํ…Œ์ŠคํŠธ ์ˆ˜ํ–‰์€ CLI๋กœ ์‹คํ–‰ํ•œ๋‹ค. lintest๊ฐ€ ๊ธ€๋กœ๋ฒŒ ๋ชจ๋“ˆ๋กœ ์„ค์น˜ ๋˜์–ด์žˆ๋Š” ๊ฒฝ์šฐ ์ปค๋งจ๋“œ๋ผ์ธ์—์„œ ์•„๋ž˜์™€ ๊ฐ™์ด ์‹คํ–‰ ํ•  ์ˆ˜ ์žˆ๋‹ค.

# ๋ฆฐํŠธ ์‹คํ–‰์‹œ
$ lintest lint [fix|debug]

# ํ…Œ์ŠคํŠธ ์‹คํ–‰์‹œ
$ lintest test [watch|coverage]

์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋‚ด์—์„œ ๋ฆฐํŠธ ๋ฐ ํ…Œ์ŠคํŠธ ํ™˜๊ฒฝ์„ค์ • ๋‚ด์šฉ์ด ํ•„์š”ํ•  ๊ฒฝ์šฐ export ๋ช…๋ น์„ ์‚ฌ์šฉํ•˜์—ฌ ์ƒ์„ฑ๋œ ํ™˜๊ฒฝ์„ค์ • ํŒŒ์ผ์„ ์ฐธ์กฐํ•œ๋‹ค. ์ˆ˜ํ–‰๊ฒฐ๊ณผ๋Š” ./node_modules/.cache/lintest ํ•˜์œ„ ๊ฒฝ๋กœ์— ํŒŒ์ผ์ด ์ƒ์„ฑ๋œ๋‹ค.

ํ™˜๊ฒฝ์„ค์ • ๋ฐ ์‹คํ–‰ํŒŒ์ผ์˜ ๊ฒฝ๋กœ ์ •๋ณด ๋“ฑ์ด ํฌํ•จ๋˜์–ด ์žˆ๋‹ค.

$ lintest export

NPM

NPM ํ”„๋กœ์ ํŠธ์—์„œ๋Š” npm run ๋ช…๋ น์œผ๋กœ ์‹คํ–‰๋˜๋„๋ก ์•„๋ž˜์™€ ๊ฐ™์ด package.json ํŒŒ์ผ ๋‚ด์— ์„ค์ •ํ•œ๋‹ค.

{
  "scripts": {
    "lint": "lintest lint",
    "lint:fix": "lintest lint fix",
    "lint:debug": "lintest lint debug",
    "test": "lintest test",
    "test:watch": "lintest test watch",
    "test:coverage": "lintest test coverage"
  }
}

Test setup files

๊ฐ ๋‹จ์œ„ ํ…Œ์ŠคํŠธ๋ฅผ ์ˆ˜ํ–‰ํ•˜๊ธฐ ์ „ mocking method๋‚˜ ์ดˆ๊ธฐ ์„ค์ •์„ ํ•  ์ˆ˜ ์žˆ๋„๋ก ์…‹์—… ํŒŒ์ผ์„ ์ถ”๊ฐ€ ํ•  ์ˆ˜ ์žˆ๋‹ค. ์ ์šฉ๋  ํ…Œ์ŠคํŠธ ์…‹์—… ํŒŒ์ผ์€ ์•„๋ž˜ ๋ชฉ๋ก์—์„œ ์กด์žฌํ•˜๋Š” ํŒŒ์ผ์„ ์ฐพ์•„ ์‚ฌ์šฉํ•˜๊ฒŒ ๋œ๋‹ค.

์ž์„ธํ•œ ๋‚ด์šฉ์€ Jest ๊ด€๋ จ ๋ฌธ์„œ๋ฅผ ์ฐธ๊ณ .

<rootDir>/src/test/@setup.ts (or .js)
<rootDir>/test/@setup.ts (or .js)
<rootDir>/test-setup.ts (or .js)

Lint rule module

main ํŒŒ์ผ์— ์•„๋ž˜์™€ ๊ฐ™์€ ํ˜•ํƒœ์˜ lint rule ์ •์˜ ํŒŒ์ผ๋งŒ ํ•„์š”ํ•˜๋‹ค.

  • lintRules ํ•˜์œ„ ํ•ญ๋ชฉ์˜ ๋ฃฐ๋“ค์€ prefix๋ฅผ ๋ถ™์ด์ง€ ์•Š์•„๋„ ๋œ๋‹ค.

    typescript ํ•ญ๋ชฉ์˜ '@typescript-eslint/indent' ๋ฃฐ์„ ์ •์˜ํ•  ๋•Œ '@typescript-eslint/'๋Š” ๊ตณ์ด ๋ถ™์—ฌ์ฃผ์ง€ ์•Š์•„๋„ 'typescript' ํ•ญ๋ชฉ ํ•˜์œ„์— ์„ ์–ธํ•˜๋ฉด prefix๋Š” '@typescript-eslint/'๋กœ ์ž๋™ ๊ณ ์ •๋œ๋‹ค.

// index.js

module.exports = {
  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',
    },
    vue: {
      'attribute-hyphenation': 'off',
      'vue/html-closing-bracket-spacing': 'off',
      'vue/html-indent': ['error', 2],
      'html-self-closing': 'off',
    },
    unicorn: {
      'escape-case': 'error',
    },
  },
}

Change Log

ํ•ด๋‹น ํ”„๋กœ์ ํŠธ์˜ ๋ณ€๊ฒฝ์‚ฌํ•ญ์€ CHANGELOG.md ํŒŒ์ผ ์ฐธ์กฐ.

License

ํ•ด๋‹น ํ”„๋กœ์ ํŠธ์˜ ๋ผ์ด์„ผ์Šค๋Š” LICENSE ํŒŒ์ผ ์ฐธ์กฐ.

Keywords

typescript

FAQs

Package last updated on 18 May 2020

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