Conversation
c24c2fe to
5ef4ab8
Compare
| @@ -0,0 +1,16 @@ | |||
| { | |||
| "name": "bem-xjst-static-analyzer", | |||
There was a problem hiding this comment.
Ух, а почему это отдельный модуль?
There was a problem hiding this comment.
(кажется я уже писал ответ, но гитхаб его не отображает почему-то)
Это не отдельный модуль, это просто результат запуска npm init, чтобы сделать зависимости.
migration/lib/index.js
Outdated
|
|
||
| cmd = cmd.join(' '); | ||
|
|
||
| execSync(cmd, { stdio: [ 0, 1, 2 ], encoding: 'utf8' }) |
There was a problem hiding this comment.
Проверить что exit 1 прокидывается.
migration/lib/logger.js
Outdated
| console.warn(shift, opts.descr); | ||
| console.warn(shift, opts.file.path + ':' + opts.path.start.line); | ||
| console.warn(shift, opts.file.source.slice(opts.path.start, opts.path.end)); | ||
| console.warn('\n'); |
There was a problem hiding this comment.
package.json
Outdated
| "bem-xjst": "bin/bem-xjst" | ||
| "bem-xjst": "bin/bem-xjst", | ||
| "lint": "bin/lint", | ||
| "mirgate": "bin/migrate" |
There was a problem hiding this comment.
кажется, что так у нас появится тулза mirgate (miRgate?) и lint, это не очень, могут быть конфликты
bin/lint
Outdated
| @@ -0,0 +1,7 @@ | |||
| if [ "$#" -ne 2 ]; then | |||
There was a problem hiding this comment.
rename file to bin/bem-xjst-lint
migration/lib/index.js
Outdated
|
|
||
| cmd = cmd.join(' '); | ||
|
|
||
| execSync(cmd, { stdio: [ 0, 1, 2 ], encoding: 'utf8' }) |
There was a problem hiding this comment.
For convenience, options.stdio may be one of the following strings:
'pipe' - equivalent to ['pipe', 'pipe', 'pipe'](the default)
'ignore' - equivalent to ['ignore', 'ignore', 'ignore']
'inherit' - equivalent to [process.stdin, process.stdout, process.stderr] or [0,1,2]
5ef4ab8 to
0e5f773
Compare
This is for v1→v2 |
|
I don't see warn about |
28f4e7d to
39cbf67
Compare
78737aa to
f1b9b46
Compare
|
Time to finish. |
2be5ea2 to
b7587be
Compare
Fixes
Changes proposed in this pull request
I introduce two features:
Both of them on jscodeshift + my boilerplate code for logging and AST checking.
How static lint work?
lint— lint option (if not present script will rewrite your templates)input— path to templates (relative to current directory or absolute)7— current major version of bem-xjst templates8— version to check forThe output of comand will be:
How migrate tool work?
Migration tool work the same as lint tool. Except you shouldn’t pass
lintoption.Templates will be changed. So be aware of changing something without version control.
TODO
Transformers:
for v7 to v8
mix()toaddMix()attrs()toaddAttrs()for v6 to v7
this.isArray(argument)toArray.isArray(argument)once()todef()for v5 to v6
for v4 to v5
elemMatch(argument)toelem('*').match(function() { ... }).modsforelem(instead ofelemMods). behaviormodsandelemModsBEMJSON fields are changed. bem-xjst should not treatelemModsasmods. See qfox’s comment — BEMJSON tested in runtime lint.for v2 to v3
apply.call(BEMJSON). Useapply(BEMJSON).for v1 to v2
Some common checks:
mix()([])to function generator instead:function() { return []; }.ctx.mods(instead ofthis.mods) — checked in runtime linter