7.1.1 • Published 5 years ago

@zthun/web-styles v7.1.1

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

Description

Zthun's web styles is a collection of lint files and tools that easily allow you to validate coding standards.

Getting Started

npm install @zthun/web-styles --save-dev

You may want to create local lint files. The main purpose of this is to have maximum support with different editors.

ln -s node_modules/@zthun/web-styles/lint/.eslintrc .eslintrc
ln -s node_modules/@zthun/web-styles/lint/.tslint.json tslint.json
ln -s node_modules/@zthun/web-styles/lint/.sass-lint.yml .sass-lint.yml
ln -s node_modules/@zthun/web-styles/lint/.htmlhintrc .htmlhintrc

Alternatively, eslint, tslint, and sass-lint allow you to create non soft linked files that extend other configs. This way is recommended for Windows users since windows doesn't really have the concept of symbolic links and can't really read them as shortcuts.

.eslintrc =>
{
    "extends": "./node_modules/@zthun/web-styles/lint/.eslintrc"
}

tslint.json =>
{
    "extends": "./node_modules/@zthun/web-styles/lint/tslint.json"
}

.sass-lint.yml =>
options:
    config-file: './node_modules/@zthun/web-styles/lint/.sass-lint.yml'

In your package json, add the following

"scripts": {
    "lint": "zlint"
},
"zlint": {
    "esFiles": ["globs/to/js-files"],
    "tsFiles": ["globs/to/ts-files"],
    "sassFiles": ["globs/to/sass-files"],
    "htmlFiles": ["globs/to/html-files"],
    "jsonFiles": ["glob/to/json-files"],
    "yamlFiles": ["globs/to/yaml-files"]
}

Now you can run linting with

npm run lint

Contents

The following styling options are included in this package under the lint folder.

Config FileForDescription
.htmlhintrcHTMLUsed for htmlhint checks.
.sass-lint.ymlSASSUsed for sasslint checks.
.eslintrcJavascriptUsed for eslint checks.
tslint.jsonTypescriptUsed for tslint checks.

Usage

zlint options

OptionAliasDescriptionType
--versionShow version numberboolean
--config-cOptional config file to use.string
--helpShow helpboolean

Config File

If you do not specify a config file on the command line, the linter will look at your package.json file for a key named zlint.

Please note that having any values undefined will mean that the linter for those files will be skipped.

KeyDescriptionTypeDefault
esConfigThe path to the .eslintrc filestringnode_modules/@zthun/web-styles/lint/.eslintrc
tsConfigThe path to the tslint.json filestringnode_modules/@zthun/web-styles/lint/tslint.json
sassConfigThe path to the .sass-lint.yml filestringnode_modules/@zthun/web-styles/lint/.sass-lint.yml
htmlConfigThe path to the .htmlhintrc filestringnode_modules/@zthun/web-styles/lint/.htmlhintrc
esFilesThe javascript file globs to lintarrayundefined
tsFilesThe typescript file globs to lintarrayundefined
sassFilesThe sass file globs to lintarrayundefined
htmlFilesThe html file globs to lintarrayundefined
jsonFilesThe json file globs to lintarrayundefined
yamlFilesThe yml file globs to lintarrayundefined