Skip to content

Commit

Permalink
Merge pull request #558 from /issues/557@v2
Browse files Browse the repository at this point in the history
Update linters. Closes #557
  • Loading branch information
tadatuta committed Jul 2, 2014
2 parents ee08c96 + df8d922 commit b19272a
Show file tree
Hide file tree
Showing 58 changed files with 207 additions and 132 deletions.
1 change: 0 additions & 1 deletion .bem/level.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
exports.baseLevelName = 'project';

1 change: 0 additions & 1 deletion .bem/levels/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,3 @@ exports.getTechs = function() {

return techs;
};

1 change: 0 additions & 1 deletion .bem/levels/bundles.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ exports.getTechs = function() {

return techs;
};

2 changes: 1 addition & 1 deletion .bem/levels/docs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
exports.getTechs = function() {
return {
'md': require.resolve('../techs/md.js')
'md' : require.resolve('../techs/md.js')
};
};
1 change: 0 additions & 1 deletion .bem/levels/examples-set.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
exports.baseLevelPath = require.resolve('./bundles.js');

1 change: 0 additions & 1 deletion .bem/levels/specs-set.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
exports.baseLevelPath = require.resolve('./bundles.js');

1 change: 0 additions & 1 deletion .bem/levels/tests-set.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
exports.baseLevelPath = require.resolve('./bundles.js');

6 changes: 0 additions & 6 deletions .bem/make.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ try {
require('bem/lib/logger').warn('"bem-pr" is not installer');
}


MAKE.decl('Arch', {

blocksLevelsRegexp : /^.+?\.blocks$/,
Expand All @@ -33,7 +32,6 @@ MAKE.decl('Arch', {

});


MAKE.decl('SetsNode', {

/**
Expand All @@ -53,7 +51,6 @@ MAKE.decl('SetsNode', {

});


MAKE.decl('TargetBundleNode', {

'desktop-levels' : function() {
Expand Down Expand Up @@ -90,7 +87,6 @@ MAKE.decl('TargetBundleNode', {

});


MAKE.decl('ExampleNode', {

getTechs : function() {
Expand All @@ -107,7 +103,6 @@ MAKE.decl('ExampleNode', {

});


MAKE.decl('SpecNode', {

getTechs : function() {
Expand All @@ -129,4 +124,3 @@ MAKE.decl('SpecNode', {
}

});

3 changes: 1 addition & 2 deletions .bem/nodes/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ registry.decl('BundleNode', {
];
},

'create-html-node': function(tech, _) {
'create-html-node' : function(tech, _) {
var args = [].slice.call(arguments, 1);

~this.getPath().indexOf('test-bemtree') &&
Expand Down Expand Up @@ -58,4 +58,3 @@ registry.decl('BundleNode', {
});

};

1 change: 0 additions & 1 deletion .bem/nodes/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
module.exports = function(registry) {
require('./bundle.js')(registry);
};

16 changes: 8 additions & 8 deletions .bem/techs/bemhtml.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ exports.API_VER = 2;

exports.techMixin = {

getBuildSuffixesMap: function() {
getBuildSuffixesMap : function() {
return {
'bemhtml.js': ['bemhtml', 'bemhtml.xjst']
'bemhtml.js' : ['bemhtml', 'bemhtml.xjst']
};
},

Expand Down Expand Up @@ -44,19 +44,19 @@ exports.techMixin = {
optimize = process.env[exportName + '_ENV'] !== 'development';

return BEMHTML.generate(sources, {
wrap: true,
exportName: exportName,
optimize: optimize,
cache : optimize && process.env[exportName + '_CACHE'] === 'on'
wrap : true,
exportName : exportName,
optimize : optimize,
cache : optimize && process.env[exportName + '_CACHE'] === 'on'
});
},

getExportName: function() {
getExportName : function() {
return 'BEMHTML';
},

getCreateResult : function(path, suffix, vars) {
if (vars.opts && vars.opts.content) return vars.opts.content;
if(vars.opts && vars.opts.content) return vars.opts.content;

var tmpl = ['block(\'{{bemBlockName}}\')'];

Expand Down
6 changes: 3 additions & 3 deletions .bem/techs/bemtree.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ exports.baseTechPath = require.resolve('./bemhtml.js');

exports.techMixin = {

getBuildSuffixesMap: function() {
getBuildSuffixesMap : function() {
return {
'bemtree.js': ['bemtree']
'bemtree.js' : ['bemtree']
};
},

getCreateSuffixes : function() {
return ['bemtree'];
},

getExportName: function() {
getExportName : function() {
return 'BEMTREE';
}

Expand Down
10 changes: 5 additions & 5 deletions .bem/techs/browser.js+bemhtml.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports.baseTechName = 'browser.js';

exports.techMixin = {

getBuildResults: function(decl, levels, output, opts) {
getBuildResults : function(decl, levels, output, opts) {
var _this = this;

return this.__base(decl, levels, output, opts)
Expand All @@ -19,7 +19,7 @@ exports.techMixin = {
});
},

concatBemhtml: function(res, output, opts) {
concatBemhtml : function(res, output, opts) {
var _this = this,
context = this.context,
declaration = context.opts.declaration;
Expand All @@ -29,13 +29,13 @@ exports.techMixin = {

decl = decl.depsByTechs;

if (!decl || !decl.js || !decl.js.bemhtml) return;
if(!decl || !decl.js || !decl.js.bemhtml) return;

decl = { deps: decl.js.bemhtml };
decl = { deps : decl.js.bemhtml };

var bemhtmlTech = context.createTech('bemhtml');

if (bemhtmlTech.API_VER !== 2) return Q.reject(new Error(_this.getTechName() +
if(bemhtmlTech.API_VER !== 2) return Q.reject(new Error(_this.getTechName() +
' can’t use v1 bemhtml tech to concat bemhtml content. Configure level to use v2 bemhtml.'));

// ugly hack for https://github.com/bem/bem-core/issues/392
Expand Down
2 changes: 1 addition & 1 deletion .bem/techs/browser.js.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ exports.techMixin = {
return this.getBuildResultChunk(ymRelPath);
}

};
};
12 changes: 6 additions & 6 deletions .bem/techs/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports.API_VER = 2;

exports.techMixin = {

getBemhtml: function(prefix) {
getBemhtml : function(prefix) {

var path = this.getPath(prefix, 'bemhtml.js');
return BEM.util.readFile(path)
Expand All @@ -19,7 +19,7 @@ exports.techMixin = {

},

getBemjson: function(prefix) {
getBemjson : function(prefix) {

var path = this.getPath(prefix, 'bemjson.js');
return BEM.util.readFile(path)
Expand All @@ -29,7 +29,7 @@ exports.techMixin = {

},

getHtml: function(bemhtml, bemjson) {
getHtml : function(bemhtml, bemjson) {

return Q.all([bemhtml, bemjson])
.spread(function(bemhtml, bemjson) {
Expand All @@ -38,20 +38,20 @@ exports.techMixin = {

},

getCreateResult: function(path, suffix, vars) {
getCreateResult : function(path, suffix, vars) {

return this.getHtml(
this.getBemhtml(vars.Prefix),
this.getBemjson(vars.Prefix));

},

storeCreateResult: function(path, suffix, res, force) {
storeCreateResult : function(path, suffix, res, force) {
// always overwrite html files
return this.__base(path, suffix, res, true);
},

getDependencies: function() {
getDependencies : function() {
return ['bemjson.js', 'bemhtml.js'];
}

Expand Down
4 changes: 2 additions & 2 deletions .bem/techs/md.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ var DEFAULT_LANGS = ['ru', 'en'];

exports.techMixin = {

getLangs: function() {
getLangs : function() {
var env = process.env.BEM_I18N_LANGS;
return env? env.split(' ') : [].concat(DEFAULT_LANGS);
},

getSuffixes: function() {
getSuffixes : function() {

return this.getLangs()
.map(function(lang) {
Expand Down
18 changes: 9 additions & 9 deletions .enb/make.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ module.exports = function(config) {
suffixes : ['tests']
});

config.nodes(['desktop.examples/*/*', 'desktop.tests/*/*'], function (nodeConfig) {
config.nodes(['desktop.examples/*/*', 'desktop.tests/*/*'], function(nodeConfig) {
var nodeDir = nodeConfig.getNodePath(),
blockSublevelDir = path.join(nodeDir, '..', '.blocks'),
sublevelDir = path.join(nodeDir, 'blocks'),
Expand All @@ -102,7 +102,7 @@ module.exports = function(config) {
nodeConfig.addTech([levels, { levels : extendedLevels }]);
});

config.nodes(['touch-pad.examples/*/*', 'touch-pad.tests/*/*'], function (nodeConfig) {
config.nodes(['touch-pad.examples/*/*', 'touch-pad.tests/*/*'], function(nodeConfig) {
var nodeDir = nodeConfig.getNodePath(),
blockSublevelDir = path.join(nodeDir, '..', '.blocks'),
sublevelDir = path.join(nodeDir, 'blocks'),
Expand All @@ -119,7 +119,7 @@ module.exports = function(config) {
nodeConfig.addTech([levels, { levels : extendedLevels }]);
});

config.nodes(['touch-phone.examples/*/*', 'touch-phone.tests/*/*'], function (nodeConfig) {
config.nodes(['touch-phone.examples/*/*', 'touch-phone.tests/*/*'], function(nodeConfig) {
var nodeDir = nodeConfig.getNodePath(),
blockSublevelDir = path.join(nodeDir, '..', '.blocks'),
sublevelDir = path.join(nodeDir, 'blocks'),
Expand Down Expand Up @@ -148,7 +148,7 @@ module.exports = function(config) {
nodeConfig.addTech([levels, { levels : extendedLevels }]);
});

config.nodes(['*.examples/*/*', '*.tests/*/*', '*.bundles/*'], function (nodeConfig) {
config.nodes(['*.examples/*/*', '*.tests/*/*', '*.bundles/*'], function(nodeConfig) {
// Base techs
nodeConfig.addTechs([
deps,
Expand Down Expand Up @@ -209,7 +209,7 @@ module.exports = function(config) {
]);
});

config.nodes(['*.examples/*/*', '*.tests/*/*', '*.bundles/index'], function (nodeConfig) {
config.nodes(['*.examples/*/*', '*.tests/*/*', '*.bundles/index'], function(nodeConfig) {
var langs = config.getLanguages();

// Base techs
Expand Down Expand Up @@ -248,17 +248,17 @@ module.exports = function(config) {
]);
});

config.mode('development', function () {
config.nodes(['*.examples/*/*', '*.tests/*/*', '*.bundles/*'], function (nodeConfig) {
config.mode('development', function() {
config.nodes(['*.examples/*/*', '*.tests/*/*', '*.bundles/*'], function(nodeConfig) {
nodeConfig.addTechs([
[copyFile, { source : '?.css', target : '_?.css' }],
[copyFile, { source : '?.js', target : '_?.js' }]
]);
});
});

config.mode('production', function () {
config.nodes(['*.examples/*/*', '*.tests/*/*', '*.bundles/*'], function (nodeConfig) {
config.mode('production', function() {
config.nodes(['*.examples/*/*', '*.tests/*/*', '*.bundles/*'], function(nodeConfig) {
nodeConfig.addTechs([
[borschik, { source : '?.css', target : '_?.css', freeze : true }],
[borschik, { source : '?.js', target : '_?.js', freeze : true }]
Expand Down
8 changes: 4 additions & 4 deletions .enb/techs/html-from-bemtree.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ module.exports = require('enb/lib/build-flow').create()
.target('destTarget', '?.html')
.useSourceFilename('bemhtmlTarget', '?.bemhtml.js')
.useSourceFilename('bemtreeTarget', '?.bemtree.js')
.builder(function (bemhtmlFilename, bemtreeFilename) {
.builder(function(bemhtmlFilename, bemtreeFilename) {
dropRequireCache(require, bemtreeFilename);

return asyncRequire(bemtreeFilename).then(function (bemtree) {
return asyncRequire(bemtreeFilename).then(function(bemtree) {
dropRequireCache(require, bemhtmlFilename);

return asyncRequire(bemhtmlFilename).then(function (bemhtml) {
return bemtree.BEMTREE.apply({}).then(function (bemjson) {
return asyncRequire(bemhtmlFilename).then(function(bemhtml) {
return bemtree.BEMTREE.apply({}).then(function(bemjson) {
if(!bemhtml.BEMHTML && bemhtml.lib) {
return bemhtml.apply(bemjson);
} else {
Expand Down
Loading

0 comments on commit b19272a

Please sign in to comment.