jshint/fixmyjs
소개
사소한 린트 오류를 자동으로 수정합니다.
기타 프로젝트측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Originalfixmyjs
Meant to automatically fix your JavaScript errors in a non-destructive way.
Installing
npm install fixmyjs -g
Usage
fixmyjs your_file.js
Programatically
var fixmyjs = require('fixmyjs')
var stringFixedCode = fixmyjs.fix(stringOfCode, objectOfOptions)
Tools
Options
These options are mostly named after their JSHINT counterparts.
Built in
delete- Removes deletion of variablesemptyStatement- Removes empty statementsinitUndefined- Rewrites variable initializations to undefinedinvalidConstructor- Does not allow you to initialize built-in primitive constructorsisNaN- Replaces equality to NaN with isNaNuseLiteral- Rewrites your primitives to use their literal form
Truthy
When these are set to true the options apply.
camelcase- Converts all identifiers to camelCasecurly- Adds curly braces to all statements that don't have themes3- Adds a radix parameter to parseIntnonew- Removes new when using it for side effectssnakecase- Convert all identifiers to snake_casemultivar- Replace single var with multi line varplusplus- Converts++and--to+= 1||-= 1eqeqeq- Enforce strict equality
Falsy
When these are set to false the options apply.
debug- Removes debugger statementssub- Dot notation conversion
Legacy Mode
fixmyjs supports a legacy mode which can be used via the CLI and programatically.
CLI
fixmyjs --legacy your_file.js
Programatically
var jshint = require('jshint').JSHINT
var fixmyjs = require('fixmyjs')
jshint(stringOfCode, objectOfOptions)
var stringFixedCode = fixmyjs(jshint.data(), stringOfCode, objectOfOptions).run()
Legacy uses JSHINT to determine what needs to be fixed and then uses a combination of regular expressions and string replacements to non-destructively fix any errors. While non-legacy supports more options, it is more prone to being destructive since the JavaScript is rewritten by the program.
Why is it legacy?
We're planning on moving away from code string transformations and into transforming the AST directly because these rules are easier to write, maintain, and offers flexibility in terms of what can be supported. 2.0 release will have fixmyjs using recast which will make fixmyjs more performant and less destructive, esformatter will also be included to perform any style changes.
License
관련 프로젝트 살펴보기
불러오는 중…