
Security News
Rust RFC Proposes a Security Tab on crates.io for RustSec Advisories
Rustβs crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.
@lintest/cli
Advanced tools
Copyright 2021. mornya. All rights reserved.
Integrated lint and test environment project.
ν΄λΉ λΌμ΄λΈλ¬λ¦¬λ κΈλ‘λ² μμμ μ€μΉνλ€.
npmλμyarnμ¬μ©μ, νλ‘μ νΈ λ£¨νΈ κ²½λ‘μpackage-lock.jsonνμΌμ΄ μ‘΄μ¬νλ©΄ μ κ±°νκ³yarn.lockνμΌλ§ μ°Έμ‘°λλλ‘ νλ€.
$ npm install -g @lintest/cli
or
$ yarn global add @lintest/cli
$ lintest [commands] [args...]
μ¬μ©κ°λ₯ν commandsλ μλμ κ°λ€.
export: λ¦°νΈ λ° ν
μ€νΈ νκ²½μ€μ λ΄μ©μ JSON νμΌλ‘ μΆλ ₯νμ¬ IDEμμ μ€μ μ΄ μ°Έμ‘°λλλ‘ ν¨install: λ¦°νΈ λ£° λνλμ μ€μΉ λ° lintest μ 보 μμ±, λͺ¨λ μ
κ·Έλ μ΄λlint: νλ‘μ νΈ λ΄ μ½λμ λν λ¦°νΈ μνtest: νλ‘μ νΈ λ΄ ν
μ€νΈ μ½λμ λν ν
μ€νΈμΌμ΄μ€ μνuninstall: μμ±λ μ 보 λ° λ³΅μ¬λ νμΌ λ± install/export μνμ λ°λ₯Έ κ΄λ ¨ νμΌ μ κ±°lintest νκ²½μ€μ μ νλ‘μ νΈ λ£¨νΈ κ²½λ‘μ lintest.config.{js,json} νμΌλ‘ μμ±νλ©΄ λλ€.
ν΄λΉ νμΌμ΄ μ‘΄μ¬νλ©΄ lintest install λͺ
λ Ή μνμ providerνλͺ©μΌλ‘ μ§μ λ λνλμκ° νλ‘μ νΈμ μ€μΉ νΉμ μ
λ°μ΄νΈ λλ©°, λ¦°νΈ λ£°μ ν΄λΉ λνλμ μ€μ μ λ°λ₯΄κ² λλ€.
// lintest.config.js
module.exports = {
provider: 'sample', // required
// 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)
},
disableLintIgnore: false, // disables .eslintignore usage
enableCompatibility: false, // turns on ESLint parserOptions.createDefaultProgram
}
μμ κ°μ΄ μ€μ νλ©΄ lintest install λͺ
λ Ή μ€νμ @lintest/rules-sample λνλμκ° νλ‘μ νΈ λ΄ μ€μΉκ° λλ©° lint ruleμ ν΄λΉ λνλμ λ΄ μ€μ μ λ°λ₯Έλ€.
κ·Έλ¦¬κ³ lintest export λͺ
λ Ή μ€νμ ν΄λΉ νμΌλ‘ λ΄λΆ νκ²½μ€μ κ°λ€μ΄ μΆλ ₯λλ€.
rules λνλμ μμ±μ μλμμ λ€λ£¬λ€.
λ¦°νΈ λ° ν μ€νΈ μνμ CLIλ‘ μ€ννλ©°, 컀맨λλΌμΈμμ μλμ κ°μ΄ μ€ν ν μ μλ€.
# λ¦°νΈ μ€νμ
$ lintest lint [fix][debug][nocache]
# ν
μ€νΈ μ€νμ
$ lintest test [watch][coverage][nocache]
λ¦°νΈ λ° ν
μ€νΈ νκ²½μ€μ λ΄μ©μ΄ νμν κ²½μ° export λͺ
λ Ήμ μ¬μ©νμ¬ νκ²½μ€μ μ μ°Έκ³ ν μ μλ€.
μνκ²°κ³Όλ νλ‘μ νΈ λ£¨νΈ κ²½λ‘μ ESLint νκ²½μ€μ νμΌ λ° Jest νκ²½μ€μ νμΌμ΄ μΆλ ₯λλ€ (lintest.config νμΌμμ μ§μ ν νμΌκ²½λ‘λ‘ λ³κ²½ κ°λ₯).
λ§μ½ μ μμ μΈ μΆλ ₯μ΄ λμ§ μλλ€λ©΄ debug νλΌλ―Έν°λ‘ νμΈνλ€.
$ lintest export [debug]
NPM νλ‘μ νΈμμλ npm run λͺ
λ ΉμΌλ‘ μ€νλλλ‘ μλμ κ°μ΄ package.json νμΌ λ΄μ μ€μ νλ€.
{
"scripts": {
"lint": "lintest lint",
"lint:fix": "lintest lint fix",
"lint:debug": "lintest lint debug nocache",
"test": "lintest test",
"test:watch": "lintest test watch",
"test:coverage": "lintest test coverage nocache"
}
}
νλ‘μ νΈ npm install νμ lintest μ λ°μ΄νΈ λ° λ£° μ λ°μ΄νΈλ₯Ό μλμΌλ‘ μνν΄ μ€ μ μλλ‘ μλμ κ°μ΄ μ€μ ν΄λ μ’λ€.
exit 0μ lintestκ° μ€μΉλμ΄ μμ§ μμ κ²½μ°, μ€λ₯λ‘ μΈν΄ λ€μ νλ‘μΈμ€κ° λμνμ§ μλ κ²μ λ°©μ§νκΈ° μν΄ μ μμ’ λ£λ‘ μ²λ¦¬νλλ‘ ν΄μ€λ€.
{
"scripts": {
"postinstall": "lintest install || exit 0",
"postuninstall": "lintest install || exit 0"
}
}
ν
μ€νΈμΌμ΄μ€λ₯Ό μννκΈ° μν΄ CLIμ λνλμλ‘ μ€μΉλ jest λ°μ΄λλ¦¬κ° μ€νλλ€.
ν
μ€νΈ νμΌμ νλ‘μ νΈ λ΄ μ‘΄μ¬νλ *.{test,spec}.{ts,tsx,js,jsx} νμΌλ€μ΄ ν
μ€νΈ λμμ΄ λλ€.
κ° λ¨μ ν μ€νΈλ₯Ό μννκΈ° μ mocking methodλ μ΄κΈ° μ€μ μ ν μ μλλ‘ μ μ νμΌμ μΆκ° ν μ μλ€. μ μ©λ ν μ€νΈ μ μ νμΌμ μλ λͺ©λ‘μμ μ‘΄μ¬νλ νμΌμ λͺ¨λ μ°Ύμ μ¬μ©νκ² λλ€.
μμΈν λ΄μ©μ Jest κ΄λ ¨ λ¬Έμλ₯Ό μ°Έκ³ .
<rootDir>/src/test/@setup.ts (or .js)
<rootDir>/src/tests/@setup.ts (or .js)
<rootDir>/test/@setup.ts (or .js)
<rootDir>/tests/@setup.ts (or .js)
<rootDir>/test-setup.ts (or .js)
μλ λͺ
λ ΉμΌλ‘ ν
μ€νΈ 컀λ²λ¦¬μ§ λ°μ΄ν°λ₯Ό νλ‘μ νΈ λ΄ /coverage λλ ν 리μ μμ±ν μ μλ€.
lintest test coverage
ν¨ν€μ§λͺ
μ @lintest/rules-{νλ‘λ°μ΄λλͺ
}μΌλ‘ μ μνκ³ NPM @lintest μ‘°μ§μ μΉμΈμ λ°μ λ°°ν¬ν¨μΌλ‘μ¨ CLIμμ ν΄λΉ ν¨ν€μ§λ₯Ό λ°μ λ¦°νΈ λ£°μ μ μ© ν μ μκ² λλ€.
package.jsonμ "main"μΌλ‘ μ€μ λ νμΌ(index.js)μ μλμ κ°μ λ¨μΌ ννμ μ μ νμΌμ΄ κΈ°λ³Έμ μΌλ‘ νμνλ€.
μ€μ κ°λ₯ νλͺ©μ prettier, lintRules, disableLintIgnore, enableCompatibility λ±μ΄ μλ€.
prettier νλͺ©μ prettier μ¬μ©μ΄ νμν λλ§ λͺ
μνλ©΄ λλ€.μλ μνμ²λΌ μ€μ ν΄μ£Όλ©΄ 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: {},
},
// 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',
},
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],
},
},
}
λ¦°νΈ νΌν¬λ¨Όμ€ ν₯μμ μν΄ μλμ κ°μ΄ performance reportλ₯Ό μ½μλ‘ μΆλ ₯ν μ μλ€.
λ¦°νΈμ μνμκ°μ 체ν¬ν΄λ³΄λ©΄μ μκ°μ΄ λ§μ΄ 걸리λ λ£°μ λν΄ λΉνμ±ννλ©΄ μνμλ ν₯μμ λμμ΄ λλ€.
$ export TIMING=1
$ npm run lint
ν΄λΉ νλ‘μ νΈμ λ³κ²½μ¬νμ CHANGELOG.md νμΌ μ°Έμ‘°.
ν΄λΉ νλ‘μ νΈμ λΌμ΄μΌμ€λ LICENSE νμΌ μ°Έμ‘°.
FAQs
Integrated lint and test environment project
The npm package @lintest/cli receives a total of 2 weekly downloads. As such, @lintest/cli popularity was classified as not popular.
We found that @lintest/cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Rustβs crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.

Security News
/Research
Socket found a Rust typosquat (finch-rust) that loads sha-rust to steal credentials, using impersonation and an unpinned dependency to auto-deliver updates.

Research
/Security Fundamentals
A pair of typosquatted Go packages posing as Googleβs UUID library quietly turn helper functions into encrypted exfiltration channels to a paste site, putting developer and CI data at risk.