Style Guide
A list of styles for different linters.
If you want an example project, check out Hafnia Times.
Overview of Packages for Each Language
| Format | Linter |
|---|---|
| HTML | yarn add htmlhint && gem install html-proofer && brew install tidy-html5 |
| CSS/SASS | yarn add stylelint stylefmt |
| JS | yarn add jscs jshint |
| Markdown | gem install markdownlint-cli |
| Python | pip install pep8 glom |
| CSV | gem install csvlint && pip install csvkit |
| Shell | brew install shellcheck |
| YAML | gem install kwalify && pip install yq |
| Go | go get -u github.com/golang/lint/golint |
Notifications when the job finishes:
Installation
Install the packages and download the linter rules using the command line:
Direct Download and Installation (Recommended)
# ( Go to the root of your project; code for doing this not included )
# Install Node.js packages and download repo to node_modules/style
yarn cache clean && yarn --silent ndarville/style
# Install Ruby packages
wget https://raw.githubusercontent.com/ndarville/style/master/Gemfile
bundle install
# Install Python packages
wget https://raw.githubusercontent.com/ndarville/style/master/requirements.txt
pip install -r requirements.txt
# Install Go packages
go get -u github.com/golang/lint/golintI prefer a pipsi and pipenv Python installation flow to pip’s:
# https://jacobian.org/writing/python-environment-2018/
# https://github.com/mitsuhiko/pipsi/issues/89
wget https://raw.githubusercontent.com/ndarville/style/master/Pipfile
pipenv install# Download linter rules to your project folder
wget https://raw.githubusercontent.com/ndarville/style/master/html/.htmlhintrc
wget https://raw.githubusercontent.com/ndarville/style/master/html/.tidyrc
wget https://raw.githubusercontent.com/ndarville/style/master/css/.stylelintrc
wget https://raw.githubusercontent.com/ndarville/style/master/javascript/.jscsrc
wget https://raw.githubusercontent.com/ndarville/style/master/javascript/.jshintrc
wget https://raw.githubusercontent.com/ndarville/style/master/python/.pep8
wget https://raw.githubusercontent.com/ndarville/style/master/markdown/.markdownlintrcDownload and installation with node_modules/
# ( Go to the root of your project; code for doing this not included )
# Install Node.js packages and download repo to node_modules/style
## Use yarn instead of npm, npm is a mess
## https://yarnpkg.com/lang/en/docs/migrating-from-npm/
yarn cache clean && yarn add ndarville/style # Used to be --silent in npm
# Install Ruby packages from node_modules/style
bundle install node_modules/style/Gemfile
# Install Python packages from node_modules/style
pip requirements -r node_modules/style/requirements.txt
# Install Go packages
go get -u github.com/golang/lint/golintYou can access the linter rules that were downloaded to
node_modules/style/master/html/.htmlhintrchtmlhint --config node_modules/style/html/.htmlhintrc
node_modules/style/master/html/.tidyrcnode_modules/style/master/css/.stylelintrcstylelint --config node_modules/style/css/.stylelintrc
node_modules/style/master/javascript/.jscsrcjscs --config node_modules/style/javascript/.jscsrc
node_modules/style/master/javascript/.jshintrcjshint --config node_modules/style/javascript/.jshintrc
node_modules/style/master/python/.pep8pep8 --config node_modules/style/python/.pep8
node_modules/style/master/markdown/.markdownlintrcmarkdownlint --config node_modules/style/markdown/.markdownlintrc
tidy
To install tidy, the HTML5 linter, which is only tentatively supported for now:
brew tap homebrew/dupes
brew install homebrew/dupes/tidy --HEAD
wget https://raw.githubusercontent.com/ndarville/style/master/html/.tidyrc
tidy -config .tidyrcAfterwards, download the required Sublime Text 3 packages:
Sublime Text Packages
- Package Control
- SublimeLinter
- Bracket Highlighter
- Emmet
- cobalt2
- Advanced CSV
- Siteleaf Liquid Syntax
- Babel
- ColorConvert
- GhostText
- SCSS
- Autoprefixer
- Git
- GitCommitMsg (not supported by ST3, looks like)
- GitGutter
- INI
- markdown-liquid-syntax
- HTML-CSS-JS-Prettify
- sublimetext-Pandoc
- SublimePrettyJson
- MarkdownEditing
- Fixes default Markdown handling and highlighting
Linters
- SublimeLinter-contrib-stylelint
- SublimeLinter-jscs
- SublimeLinter-jshint
- SublimeLinter-contrib-htmlhint
- SublimeLinter-html-tidy
- SublimeLinter-contrib-write-good
- SublimeLinter-pep8
- SublimeLinter-shellcheck
- (SublimeLinter-contrib-govet)
- (SublimeLinter-contrib-golint)
jscs now has auto-fixing support. You can using by either running the command with the -x option or by installing the ST3 jscs-formatter listed above.
Linter Rules
Continuous Integration (CI)
Status
- SASS/CSS linter
- JavaScript linter
- jscs
- jshint
- HTML (tentative)
- htmlhint
- htmlproofer
- tidy
- Python linter
- CSV linter
- Go linter
- golint
- govet
- Markdown linter
- markdownlint
- Personal linter
- Shell linter
- YAML linter
Examples
My website ndarville.com and project at Hafnia Times try to conform to the style guidelines. The latter is open source, which makes it easier for you to inspect the code.