Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] V5 #51

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions bin.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env node
/* eslint-disable import/no-commonjs */
const options = require('./options');

var options = require('./options');
var flow = process.argv.indexOf('--flow') !== -1;
const flow = process.argv.indexOf('--flow') !== -1;

require('standard-engine').cli(flow ? options.flow : options);
22 changes: 22 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# v5.0
* **change** enforce using Errors in throws and when rejecting Promises
* **change** Changes to the flow mode (`miclint --flow`)
* Functions must have return type annotation
* Files must have a file annotation and it must always use the line version (`// @flow`)
* Functions must have parameter type annotation
* React: Don't require defaultProps
* **internal** Lint miclint!

# v4.1.2

* **bugfix** Allow multiple imports in flow mode (`miclint --flow`) to import flow types (`import type { foo } from 'bar';`)

# v4.1

* **feature** `miclint --flow` will now lint with specific lint rules

# 4.0
* **change** enforce ES6 import / exports
* **change** enforce display names on react components
* **change** enforce presence of keys on react iterator children
* **change** enforce presence of dangling commas
7 changes: 7 additions & 0 deletions eslintrc-flow.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
"flowtype/no-primitive-constructor-types": 2,
"flowtype/object-type-delimiter": 2,
"flowtype/type-id-match": 2,

"flowtype/require-return-type": 2,
"flowtype/require-valid-file-annotation": [2, "always", "line"],
"flowtype/require-parameter-type": [2, { "excludeArrowFunctions": "expressionsOnly" }],

"react/require-default-props": 0,

"import/no-duplicates": 2,
"no-duplicate-imports": 0
},
Expand Down
4 changes: 3 additions & 1 deletion eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"react/jsx-key": 2,
"react/jsx-no-duplicate-props": 2,
"react/no-direct-mutation-state": 2,
"react/require-extension": [0]
"react/require-extension": [0],
"prefer-promise-reject-errors": 2,
"no-throw-literal": 2
},
"parser": "babel-eslint",
"env": {
Expand Down
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var Linter = require('standard-engine').linter;
var options = require('./options');
/* eslint-disable import/no-commonjs */
const Linter = require('standard-engine').linter;
const options = require('./options');

module.exports = new Linter(options);
module.exports = new Linter(options);
19 changes: 10 additions & 9 deletions options.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
var path = require('path');
var pkg = require('./package.json');
var eslint = require('eslint');
/* eslint-disable import/no-commonjs */
const path = require('path');
const pkg = require('./package.json');
const eslint = require('eslint');

module.exports = {
cmd: 'miclint',
version: pkg.version,
homepage: pkg.homepage,
bugs: pkg.bugs.url,
tagline: 'Mic lint',
eslint: eslint,
eslint,
eslintConfig: {
configFile: path.join(__dirname, 'eslintrc.json')
configFile: path.join(__dirname, 'eslintrc.json'),
},
formatter: null
formatter: null,
};

module.exports.flow = {
Expand All @@ -21,9 +22,9 @@ module.exports.flow = {
homepage: pkg.homepage,
bugs: pkg.bugs.url,
tagline: 'Mic lint - flow variant',
eslint: eslint,
eslint,
eslintConfig: {
configFile: path.join(__dirname, 'eslintrc-flow.json')
configFile: path.join(__dirname, 'eslintrc-flow.json'),
},
formatter: null
formatter: null,
};
21 changes: 12 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,21 @@
},
"homepage": "https://github.com/micnews/miclint#readme",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "node bin.js bin.js index.js options.js"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why bin.js twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we check bin w bin.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first we run bin, then we check it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can I make that more obvious somehow?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kesla sorry for delayed response, can it not support globs? node bin.js *.js?

},
"dependencies": {
"babel-eslint": "^7.1.1",
"eslint": "~3.15.0",
"eslint-config-airbnb": "^13.0.0",
"eslint-plugin-babel": "^4.0.0",
"eslint-plugin-flowtype": "^2.30.0",
"eslint": "^3.17.1",
"eslint-config-airbnb": "^14.1.0",
"eslint-plugin-babel": "^4.1.1",
"eslint-plugin-flowtype": "^2.30.3",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx": "0.0.2",
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-react": "^6.7.1",
"standard-engine": "^5.3.0"
"eslint-plugin-jsx": "^0.0.2",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-react": "^6.10.0",
"standard-engine": "^6.0.0"
},
"engines": {
"node": ">=4"
}
}
Loading