Skip to content

the-noob-101/eslint-plugin-flow-missing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eslint-plugin-flow-missing

npm version License Coverage badge

Mere ESLint plugin with one rule to check if one didn't forget to add the

// @flow

header on each .js file. This rule was needeed not only because forgetting to add flow is a bad practice, but also because forgetting to add it resulted in linter bugs for imports, therefore creating issues with our CI.

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-flow-missing:

$ npm install eslint-plugin-flow-missing --save-dev

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-flow-missing globally.

Usage

Add flow-missing to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["flow-missing"]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "flow-missing/flow-missing": 2
  }
}

Examples

NB: The linter is only checking when the file's extensions is '.js'

The following examples are all valid :

// @flow
const test = 0;

...
/*
  author : Alburkerk
*/
// @flow
const test = 0;

...

The following examples are all NOT valid :

//@flow
const test = 0;

...
// @ flow
const test = 0;

...
const test = 0;

...

Contributing

Feel free to do anything and submit. Just check tests before submitting :

npm test

About

Warn if flow is missing at the head of each file

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published