Skip to content

Commit

Permalink
Merge pull request #1284 from /issues/1235@v4
Browse files Browse the repository at this point in the history
Update linters @v4
  • Loading branch information
Vladimir Varankin committed Apr 6, 2016
2 parents 05e6baa + 06e83a9 commit a5f060c
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 70 deletions.
11 changes: 5 additions & 6 deletions .bem/levels/blocks.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
var PATH = require('path'),
environ = require('bem-environ'),
BEMPR_TECHS = environ.getLibPath('bem-pr', 'bem/techs'),
PRJ_TECHS = PATH.resolve(__dirname, '../techs');

var resolveTechs = exports.resolveTechs = function(registry, prefix) {
return function(name) {
registry[name] = PATH.join(prefix, name + '.js');
PRJ_TECHS = PATH.resolve(__dirname, '../techs'),
resolveTechs = exports.resolveTechs = function(registry, prefix) {
return function(name) {
registry[name] = PATH.join(prefix, name + '.js');
};
};
};

exports.getTechs = function() {
var techs = {
Expand Down
4 changes: 2 additions & 2 deletions .githooks/pre-commit/lint
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ trap cleanup EXIT SIGINT SIGHUP
git diff --no-prefix > "$PATCH_FILE"
git checkout -- .

git_cached_files=$(git diff --cached --name-only --diff-filter=ACMR | xargs echo)
git_cached_files=$(git diff --cached --name-only --diff-filter=ACMR | grep -e \.js$ -e \.bemhtml$ -e \.bemtree$ | xargs echo)
if [ "$git_cached_files" ]; then
$NPM_BIN/jshint-groups $git_cached_files || exit 1
$NPM_BIN/jscs $git_cached_files || exit 1
fi
fi
47 changes: 8 additions & 39 deletions .jscs.json
Original file line number Diff line number Diff line change
@@ -1,61 +1,30 @@
{
"plugins": ["jscs-bem"],
"preset": "bem",

"excludeFiles": [
".bem/cache/**",
".enb/tmp/**",
".git/**",
".gitignore",
"libs/**",
"node_modules/**",
"*.json",
"**/*.test.bemhtml/**",
"*.bundles/**",
"*.examples/**",
"*.tests/**",
"*.specs/**",
"*.json",
"*.tmpl-specs/**",
"common.blocks/vow/**",
"common.blocks/inherit/**",
"common.blocks/ecma/__array/ecma__array.spec.js",
"common.blocks/jquery/__event/_type/jquery__event_type_pointerclick.js",
"common.blocks/jquery/__event/_type/jquery__event_type_pointer.js",
"common.blocks/jquery/__event/_type/jquery__event_type_pointerpressrelease.js"
],
"fileExtensions": [".js", ".bemtree", ".bemhtml"],

"preset": "yandex",
"disallowMultipleVarDecl" : null,
"requireCurlyBraces" : null,
"requireSpacesInConditionalExpression" : {
"beforeConsequent": true,
"afterConsequent": true,
"beforeAlternate": true
},
"maximumLineLength" : null,
"requireSpacesInAnonymousFunctionExpression" : null,
"disallowSpaceAfterObjectKeys" : null,
"disallowSpacesInsideObjectBrackets" : null,
"disallowImplicitTypeConversion" : null,
"disallowQuotedKeysInObjects" : null,
"requireDotNotation" : null,
"disallowOperatorBeforeLineBreak" : ["."],
"disallowSpaceAfterKeywords" : ["if", "for", "while", "switch"],
"requireSpaceAfterKeywords" : ["do", "else"],
"disallowSpacesInCallExpression" : true,
"disallowSpacesInConditionalExpression" : {
"afterTest": true,
"beforeConsequent": false,
"afterConsequent": false,
"beforeAlternate": false
},
"requireSpaceAfterObjectKeys" : true,
"requireSpaceBeforeKeywords" : ["else", "while", "catch"],
"requireSpacesInsideObjectBrackets" : "all",

"plugins": [
"jscs-jsdoc"
"*.docs/**/*.bemdecl.js"
],
"jsDoc": {
"checkParamNames": true,
"requireParamTypes": true,
"leadingUnderscoreAccess": true
}
},
"fileExtensions": [".js", ".bemtree", ".bemhtml"]
}
1 change: 1 addition & 0 deletions .jshint-groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ module.exports = {
'content',
'def',
'elem',
'elemMatch',
'js',
'local',
'match',
Expand Down
2 changes: 0 additions & 2 deletions common.blocks/i-bem-dom/__collection/i-bem-dom__collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ var BemDomCollection = inherit(BemCollection, /** @lends BemDomCollection.protot
findMixedElems : buildProxyMethodForMany('findMixedElems')
});

var arrayConcat = Array.prototype.concat;

function collectionMapMethod(collection, methodName, args) {
return collection.map(function(entity) {
return entity[methodName].apply(entity, args);
Expand Down
4 changes: 3 additions & 1 deletion common.blocks/i-bem-dom/i-bem-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ function buildElemKey(elem) {
return elem.elem + buildModPostfix(elem.modName, elem.modVal);
}

// jscs:disable requireMultipleVarDecl

/**
* Returns jQuery collection for provided HTML
* @param {jQuery|String} html
Expand Down Expand Up @@ -343,7 +345,7 @@ var BemDomEntity = inherit(/** @lends BemDomEntity.prototype */{
/**
* Clearing the cache for elements
* @protected
* @param {Function|String|Object} [...elems] Nested elements names or description elem, modName, modVal
* @param {?...(Function|String|Object)} elems Nested elements names or description elem, modName, modVal
* @returns {BemDomEntity} this
*/
_dropElemCache : function(elems) {
Expand Down
6 changes: 3 additions & 3 deletions common.blocks/i-bem/__collection/i-bem__collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ var BemCollection = inherit(/** @lends BemCollection.prototype */{
/**
* Returns a new collection comprised of collection on which it is called joined with
* the collection(s) and/or array(s) and/or entity(es) provided as arguments.
* @param {Collection|Array|BemEntity} [args...]
* @param {?...(Collection|Array|BemEntity)} args
* @returns {Collection}
*/
concat : function() {
Expand Down Expand Up @@ -199,8 +199,6 @@ var BemCollection = inherit(/** @lends BemCollection.prototype */{
}
});

var arrayConcat = Array.prototype.concat;

function buildForEachEntityMethodProxyFn(methodName) {
return function() {
var args = arguments;
Expand All @@ -227,6 +225,8 @@ function buildComplexProxyFn(arrayMethodName, entityMethodName) {
};
}

var arrayConcat = Array.prototype.concat;

provide(BemCollection);

});
7 changes: 4 additions & 3 deletions common.blocks/i-bem/__collection/i-bem__collection.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,14 @@ describe('BEM collections', function() {
var b1 = Block.create(),
b2 = Block.create({ m : 'v1' }),
b3 = Block.create(),
collection = new BemCollection([b1, b2, b3]);
collection = new BemCollection([b1, b2, b3]),
res;

var res = collection.filter(function(entity) {
res = collection.filter(function(entity) {
return entity.hasMod('m');
});

res.get(0).should.be.equal(b2)
res.get(0).should.be.equal(b2);
});
});

Expand Down
3 changes: 0 additions & 3 deletions common.blocks/i-bem/i-bem.bemhtml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ BEM.INTERNAL = {

/**
* Builds the class for a block or element with a modifier
* @private
* @param {String} block Block name
* @param {String} [elem] Element name
* @param {String} [modName] Modifier name
Expand Down Expand Up @@ -99,7 +98,6 @@ BEM.INTERNAL = {

/**
* Builds modifier classes
* @private
* @param {String} block Block name
* @param {String} [elem] Element name
* @param {Object} [mods] Modifier name
Expand All @@ -126,7 +124,6 @@ BEM.INTERNAL = {

/**
* Builds full classes for a block or element with modifiers
* @private
* @param {String} block Block name
* @param {String} [elem] Element name
* @param {Object} [mods] Modifier name
Expand Down
4 changes: 2 additions & 2 deletions common.blocks/i-bem/i-bem.bemtree
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ BEMContext.prototype.doAsync = function doAsync(fn, onFulfilled, onRejected, con
_this.elemMods = elemMods;
return response;
},
promise = isFunction(fn) ? Vow.invoke(fn, context) : fn;
promise = isFunction(fn)? Vow.invoke(fn, context) : fn;

if(onFulfilled) {
promise = onRejected ? promise
promise = onRejected? promise
.then(function(response) {
return onFulfilled.call(this, restore(response));
}, function(response) {
Expand Down
7 changes: 4 additions & 3 deletions common.blocks/i-bem/i-bem.vanilla.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ function declEntity(baseCls, entityName, base, props, staticProps) {
return entityCls;
}

// jscs:disable requireMultipleVarDecl

/**
* @class BemEntity
* @description Base block for creating BEM blocks
Expand Down Expand Up @@ -294,9 +296,8 @@ var BemEntity = inherit(/** @lends BemEntity.prototype */ {
this._processingMods[modName] = curModVal;

var needSetMod = true,
modFnParams = [modName, modVal, curModVal];

var modVars = [['*', '*'], [modName, '*'], [modName, modVal]],
modFnParams = [modName, modVal, curModVal],
modVars = [['*', '*'], [modName, '*'], [modName, modVal]],
prefixes = ['before', 'after'],
i = 0, prefix, j, modVar;

Expand Down
2 changes: 1 addition & 1 deletion common.blocks/identify/identify.vanilla.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ provide(
/**
* Makes unique ID
* @exports
* @param {Object} [obj...] Object that needs to be identified
* @param {?...Object} obj Object that needs to be identified
* @returns {String} ID
*/
function(obj) {
Expand Down
2 changes: 1 addition & 1 deletion common.blocks/page/page.bemhtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ block('page')(
this._nonceCsp = ctx.nonce;

// TODO(indunty): remove local after bem/bem-xjst#50
return local({ _pageInit: true })(function() {
return local({ _pageInit : true })(function() {
return applyCtx([
ctx.doctype || '<!DOCTYPE html>',
{
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
"devDependencies": {
"bem": "~0.9.0",
"mocha": "~1.9.0",
"jshint-groups": "0.6.0",
"jscs": "1.11.3",
"jscs-jsdoc": "0.4.5",
"jshint-groups": "^0.8.0",
"jscs": "^2.11.0",
"jscs-bem": "^0.2.0",
"git-hooks": "~0.0.6",
"bower-npm-install": "~0.5.4",
"bower": "1.3.12",
Expand Down Expand Up @@ -54,6 +54,6 @@
"bem-test": "npm run deps && magic run specs && magic run tmpl-specs",
"bem-coverage": "ISTANBUL_COVERAGE=yes npm run bem-test",
"bem-jsdoc": "bem make desktop.jsdoc",
"test": "npm run bem-test && mocha --ui tdd --reporter spec common.blocks/i-bem/i-bem.test.bemhtml/*-test.js common.blocks/i-bem/__i18n/test/*-test.js common.blocks/i-bem/__i18n/i-bem__i18n.test.bemhtml/*-test.js"
"test": "npm run lint && npm run bem-test && mocha --ui tdd --reporter spec common.blocks/i-bem/i-bem.test.bemhtml/*-test.js common.blocks/i-bem/__i18n/test/*-test.js common.blocks/i-bem/__i18n/i-bem__i18n.test.bemhtml/*-test.js"
}
}

0 comments on commit a5f060c

Please sign in to comment.