https://github.com/duhaime/eslint-plugin-frontmatter
Remove YAML frontmatter from `.js` files before calling ESLint
https://github.com/duhaime/eslint-plugin-frontmatter
eslint eslint-plugin jekyll yaml
Last synced: 3 months ago
JSON representation
Remove YAML frontmatter from `.js` files before calling ESLint
- Host: GitHub
- URL: https://github.com/duhaime/eslint-plugin-frontmatter
- Owner: duhaime
- License: mit
- Created: 2017-11-17T21:58:22.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-02-27T14:33:40.000Z (over 5 years ago)
- Last Synced: 2025-01-28T05:27:28.516Z (over 1 year ago)
- Topics: eslint, eslint-plugin, jekyll, yaml
- Language: JavaScript
- Size: 36.1 KB
- Stars: 0
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# eslint-plugin-frontmatter
[](https://travis-ci.org/duhaime/eslint-plugin-frontmatter)
Remove [YAML frontmatter](https://jekyllrb.com/docs/frontmatter/) from `.js` files before calling ESLint. Given the following file:
```js
---
process: true
---
const cat = () => console.log('meow')
```
This plugin removes the frontmatter and sends the remaining content to ESLint:
```js
const cat = () => console.log('meow')
```
The use case for this plugin was JavaScript development for a site built with [Jekyll](https://jekyllrb.com/).
## Installation
You'll first need to install [ESLint](http://eslint.org):
```bash
$ npm i eslint --save-dev
```
Next, install `eslint-plugin-frontmatter`:
```bash
$ npm install eslint-plugin-frontmatter --save-dev
```
**Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `eslint-plugin-frontmatter` globally.
## Usage
Add `frontmatter` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:
```json
{
"plugins": [
"frontmatter"
]
}
```
After adding this plugin, frontmatter will be removed from your JavaScript files before they're linted.
## Tests
To start the tests, run:
```bash
npm run test
```