Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bemlinter.js

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bemlinter.js - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

4

__tests__/multiple-files/multiple-files.js

@@ -5,3 +5,3 @@ const bemlinter = require('./../../src/bemlinter');

it('should lint with crossed error', (done) => {
bemlinter(`${__dirname}/*.scss`, [], {prefix: ['c-']})
bemlinter(`${__dirname}/*.scss`, {prefix: ['c-']})
.then(logs => {

@@ -14,3 +14,3 @@ expect(logs).toMatchSnapshot();

it('should lint with crossed error', (done) => {
bemlinter(`${__dirname}/*.scss`, [], {prefix: ['', 'c-']})
bemlinter(`${__dirname}/*.scss`, {prefix: ['', 'c-']})
.then(logs => {

@@ -17,0 +17,0 @@ expect(logs).toMatchSnapshot();

@@ -15,3 +15,3 @@ const bemlinter = require('./../../src/bemlinter');

it('should lint with a missing prefix error', (done) => {
bemlinter(`${__dirname}/prefix.scss`, [], {prefix: ['c-']})
bemlinter(`${__dirname}/prefix.scss`, {prefix: ['c-']})
.then(logs => {

@@ -24,3 +24,3 @@ expect(logs).toMatchSnapshot();

it('should lint without error', (done) => {
bemlinter(`${__dirname}/prefix.scss`, [], {prefix: ['', 'c-']})
bemlinter(`${__dirname}/prefix.scss`, {prefix: ['', 'c-']})
.then(logs => {

@@ -53,3 +53,3 @@ expect(logs).toMatchSnapshot();

it('should lint without a lower case error', (done) => {
bemlinter(`${__dirname}/syntax.scss`, [], {checkLowerCase: false})
bemlinter(`${__dirname}/syntax.scss`, {checkLowerCase: false})
.then(logs => {

@@ -56,0 +56,0 @@ expect(logs).toMatchSnapshot();

{
"name": "bemlinter.js",
"version": "0.6.0",
"version": "0.7.0",
"description": "BEM linter",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -30,3 +30,3 @@ bemlinter.js [![Build Status](https://travis-ci.org/tzi/bemlinter.js.svg?branch=master)](https://travis-ci.org/tzi/bemlinter.js)

Advanced configuration
Configuration file
------

@@ -44,16 +44,39 @@

The configuration file look like this:
The configuration file is a json file:
### sources
To define the paths of your source files
```json
{
// Define the paths of your source files
"sources": [
"a/path/to/your/scss/*.scss",
"a/path/to/a/specific/scss/main.scss
],
// Define the paths of some exclude source files
]
}
```
### excludePath (option)
To define the paths of some exclude source files
default: `[]`
```json
{
"excludePath": [
"an/exclude/path/of/scss/*.scss"
],
// Define the names of some component that are not isolated yet, so the linter will be kind ;)
]
}
```
### excludeComponent (option)
To define the names of some component that are not isolated yet, so the linter will be kind ;)
default: `[]`
```json
{
"excludeComponent": [

@@ -63,12 +86,31 @@ "messed-up-component",

"old-component"
],
// Optionally disable some check or add a prefix
"options": {
"checkLowerCase": false,
"prefix": ['c-']
}
]
}
```
### checkLowerCase (option)
To disable lower case check
default: `true`
```json
{
"checkLowerCase": false
}
```
### prefix (option)
To set the authorized prefix
default: `['']`
```json
{
"prefix": ["c-"]
}
```
How to Contribute

@@ -75,0 +117,0 @@ --------

@@ -21,2 +21,3 @@ const _ = require('lodash');

const defaultOptions = {
excludeComponent: [],
checkLowerCase: true,

@@ -27,7 +28,7 @@ prefix: ['']

// Exports
module.exports = (sources, excludeComponent = [], userOptions = defaultOptions) => {
module.exports = (sources, userOptions = defaultOptions) => {
const logs = [];
const options = _.merge({}, defaultOptions, userOptions);
const blockList = globby.sync(sources, {
ignore: excludeComponent
ignore: options.excludeComponent
}).map(getBlockNameFromFile);

@@ -34,0 +35,0 @@ const filePathList = globby.sync(sources);

@@ -41,7 +41,6 @@ #!/usr/bin/env node

sources: argv._,
excludePath: [],
excludeComponent: [],
options: {
checkLowerCase: true,
prefix: ['']
}
checkLowerCase: true,
prefix: ['']
};

@@ -62,3 +61,6 @@

config.excludeComponent = config.excludeComponent.map(component => `**/${component}.scss`);
resolve(config);
resolve({
sources: config.sources,
options: _.omit(config, 'sources')
});
})

@@ -74,3 +76,3 @@ .catch(console.error)

return bemlinter(config.sources, config.excludeComponent, config.options);
return bemlinter(config.sources, config.options);
})

@@ -77,0 +79,0 @@ .then(logs => {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc