Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
bemhint – it is an extendable code quality tool for BEM projects.
This module is a core of the tool. It provides the API for external plugins which perform checks of project BEM entities.
$ npm install bemhint
$ bemhint --help
Usage:
bemhint [OPTIONS] [ARGS]
Options:
-h, --help : Help
-c CONFIGPATH, --config=CONFIGPATH : Path to a configuration file (default: .bemhint.js)
-r REPORTERS, --reporter=REPORTERS : flat, html or/and teamcity (default: flat)
Arguments:
TARGETS : Paths to BEM entities (required)
Configuration is a JavaScript/JSON file in the following format:
module.exports = {
// list of the folder names which represent redefinition levels (folders with blocks)
levels: [
'*.blocks',
'blocks-*'
],
// paths which will be ignored during the validation
excludePaths: [
'node_modules/**',
'libs/**'
],
// list of available plugins (node module names relatively to config file path)
plugins: {
// plugin is disabled
'<plugin_name>': false,
// plugin is enabled
'<plugin_name>': true,
// plugin is enabled and uses following settigns
'<plugin_name>': {
// settings
// paths which will be ignored during the validation by this plugin
excludePaths: [
'some.blocks/some-block/**',
'some.blocks/another-block/_some-mod/*',
'some.blocks/yet-another-block/yet-another-block.deps.js'
],
// set of the BEM technologies which should be validated by this plugin
techs: {
'*': false,
'js|deps.js': true,
// separated settings for `bemhtml.js`
'bemhtml.js': {
// settings
}
}
},
// plugin is enabled and will be run as many times as many configurations have been specified;
// be aware of different side effects which may appear depending on a plugin implementation
'<plugin_name>': [
{
// settings
tech: {
'deps.js': true
}
},
{
// other settings
tech: {
'bemdecl.js': true
}
}
]
}
};
Note! Plugin settings can have any other fields which needs for plugin (not only special fields excludePaths
and techs
). Set of the fields is defined by implementation of plugin.
You need to create the JavaScript file in following format:
module.exports = {
/**
* Default plugin settings (it will be merged with settings from configuration file)
* @returns {Object}
*/
configure: function() {
return {
// settings
}
},
/**
* Checks which needs the information about all BEM entities of the project
* @param {Entity[]} entities
* @param {Config} config
*/
forEntities: function(entities, config) {
...
},
/**
* Checks of the specific BEM entity
* @param {Entity} entity
* @param {Config} config
*/
forEachEntity: function(entity, config) {
...
},
/**
* Checks of the separate technology of the specific BEM entity
* @param {Object} tech
* @param {Entity} entity
* @param {Config} config
*/
forEachTech: function(tech, entity, config) {
...
}
};
Note! Your plugin should contain at least one of the functions forEntities
, forEachEntity
, forEachTech
, but configure
function is not required.
BEM entity (block, element or modifier).
Entity.prototype.getTechs
@returns {Tech[]} - list of technologies which implement this BEM entity
Entity.prototype.getTechByName
@param {String} – technology name (css, js etc. - part of a file name which goes after the first dot)
@returns {Tech} – technology of BEM entity
Entity.prototype.addError
@param {Object} - object which contains the information about an error:
{line, column}
location of error in a file; works with tech
argument onlyEntity.prototype.addWarning
This method has the same API as addError
.
Plugin configuration.
Config.prototype.getConfig
@returns {Object} – full configuration of a plugin
Config.prototype.getTechConfig
@param {String} – technology name
@returns {Object} – configuration of the specific technology
Config.prototype.isExcludedPath
@param {String} – file path
@returns {Boolean}
Config.prototype.resolvePath
@param {String} – relative path
@returns {String} – absolute path built relatively from config file location
FAQs
BEM hint
The npm package bemhint receives a total of 0 weekly downloads. As such, bemhint popularity was classified as not popular.
We found that bemhint demonstrated a not healthy version release cadence and project activity because the last version was released 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.