Skip to content

Commit

Permalink
Merge pull request #22 from arcticicestudio/task/gh-17-lint-staged
Browse files Browse the repository at this point in the history
Merge pull request #22 from arcticicestudio/task/gh-17-lint-staged

Integrated lint-staged (1) to run linters against staged Git files to
prevent to add code that violates any style guide into the code base.

>> Configuration

The configuration file `lint-staged.config.js` (1) has been placed in
the project root and includes the commands that should be run for
matching file extensions (globs). It includes at least the three
following entries with the same order as listed here:

1. `prettier --list-different` - Run Prettier (#16) against
   `*.{js,json,jsx,mdx,yml}` to ensure all files are formatted
   correctly. The `--list-different` flag prints the found files that
   are not conform to the Prettier configuration.
2. `eslint` - Run ESLint (#15) against `*.{js,jsx}` to ensure all
   JavaScript files are compliant to the style guide after being
   formatted with Prettier.
3. `remark --no-stdout` - Run remark-lint (#14) against `*.md` to ensure
   all Markdown files are compliant to the style guide. The
   `--no-stdout` flag suppresses the output of the parsed file content.

References:

  (1) https://github.com/okonet/lint-staged
  • Loading branch information
arcticicestudio authored Nov 17, 2018
2 parents 39af1da + 1af462b commit 6ab1091
Show file tree
Hide file tree
Showing 3 changed files with 958 additions and 7 deletions.
21 changes: 21 additions & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]>
* Copyright (C) 2018-present Sven Greb <[email protected]>
*
* Project: Nord Docs
* Repository: https://github.com/arcticicestudio/nord-docs
* License: MIT
*/

/**
* @file The lint-staged configuration.
* @author Arctic Ice Studio <[email protected]>
* @author Sven Greb <[email protected]>
* @see https://github.com/okonet/lint-staged#configuration
*/

module.exports = {
"*.{js,json,jsx,md,mdx,yml}": "prettier --list-different",
"*.{js,jsx}": "eslint --ext .js,.jsx",
"*.md": "remark --no-stdout"
};
Loading

0 comments on commit 6ab1091

Please sign in to comment.