Skip to content

Commit 47d5e24

Browse files
committed
initial commit
0 parents  commit 47d5e24

7 files changed

Lines changed: 216 additions & 0 deletions

File tree

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
language: node_js
2+
node_js:
3+
- '4'
4+
- 'node'

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) Feross Aboukhadijeh
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of
6+
this software and associated documentation files (the "Software"), to deal in
7+
the Software without restriction, including without limitation the rights to
8+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9+
the Software, and to permit persons to whom the Software is furnished to do so,
10+
subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Standard React - ESLint Shareable Config
2+
[![travis][travis-image]][travis-url]
3+
[![npm][npm-image]][npm-url]
4+
[![downloads][downloads-image]][downloads-url]
5+
6+
[travis-image]: https://img.shields.io/travis/feross/eslint-config-standard-jsx/master.svg
7+
[travis-url]: https://travis-ci.org/feross/eslint-config-standard-jsx
8+
[npm-image]: https://img.shields.io/npm/v/eslint-config-standard-jsx.svg
9+
[npm-url]: https://npmjs.org/package/eslint-config-standard-jsx
10+
[downloads-image]: https://img.shields.io/npm/dm/eslint-config-standard-jsx.svg
11+
[downloads-url]: https://npmjs.org/package/eslint-config-standard-jsx
12+
13+
#### An ESLint [Shareable Config](http://eslint.org/docs/developer-guide/shareable-configs) for JSX support in [JavaScript Standard Style](http://standardjs.com)
14+
15+
This module is for advanced users. You probably want to use [`standard`](http://standardjs.com) instead :)
16+
17+
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](http://standardjs.com)
18+
19+
## Install
20+
21+
```bash
22+
npm install eslint-config-standard-jsx
23+
```
24+
25+
## Usage
26+
27+
Shareable configs are designed to work with the `extends` feature of `.eslintrc` files.
28+
You can learn more about
29+
[Shareable Configs](http://eslint.org/docs/developer-guide/shareable-configs) on the
30+
official ESLint website.
31+
32+
This Shareable Config adds extra JSX style rules to the baseline JavaScript Standard Style
33+
rules provided in
34+
[`eslint-config-standard`](https://www.npmjs.com/package/eslint-config-standard).
35+
It doesn't assume that you're using React, so other virtual DOM libraries like
36+
`virtual-dom` and `deku` are supported.
37+
38+
Even thought this config is JSX only (no React), it makes use of
39+
[`eslint-plugin-react`](https://npmjs.com/package/eslint-plugin-react) for its generic
40+
JSX rules.
41+
42+
(If you want React-specific rules too, consider using
43+
[`eslint-config-standard-react`](https://www.npmjs.com/package/eslint-config-standard-react)
44+
instead.)
45+
46+
Here's how to install everything you need:
47+
48+
```bash
49+
npm install eslint-config-standard eslint-config-standard-jsx eslint-plugin-react
50+
```
51+
52+
Then, add this to your .eslintrc file:
53+
54+
```
55+
{
56+
"extends": ["standard", "standard-jsx"]
57+
}
58+
```
59+
60+
*Note: We omitted the `eslint-config-` prefix since it is automatically assumed by ESLint.*
61+
62+
You can override settings from the shareable config by adding them directly into your
63+
`.eslintrc` file.
64+
65+
### Looking for something easier than this?
66+
67+
The easiest way to use JavaScript Standard Style to check your code is to use the
68+
[`standard`](http://standardjs.com) package. This comes with a global
69+
Node command line program (`standard`) that you can run or add to your `npm test` script
70+
to quickly check your style.
71+
72+
## Badge
73+
74+
Use this in one of your projects? Include one of these badges in your readme to
75+
let people know that your code is using the standard style.
76+
77+
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](http://standardjs.com)
78+
79+
```markdown
80+
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](http://standardjs.com)
81+
```
82+
83+
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com)
84+
85+
```markdown
86+
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com)
87+
```
88+
89+
## Learn more
90+
91+
For the full listing of rules, editor plugins, FAQs, and more, visit the main
92+
[JavaScript Standard Style repo](http://standardjs.com).
93+
94+
## License
95+
96+
MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org).

eslintrc.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"parserOptions": {
3+
"ecmaVersion": 6,
4+
"ecmaFeatures": {
5+
"jsx": true
6+
}
7+
},
8+
9+
"plugins": [
10+
"react"
11+
],
12+
13+
"rules": {
14+
"react/jsx-boolean-value": 2,
15+
"react/jsx-closing-bracket-location": 2,
16+
"react/jsx-curly-spacing": [2, "never"],
17+
"react/jsx-equals-spacing": [2, "never"],
18+
"react/jsx-indent": [2, 2],
19+
"react/jsx-indent-props": [2, 2],
20+
"react/jsx-no-duplicate-props": 2,
21+
"react/jsx-no-undef": 2,
22+
"react/jsx-uses-react": 2,
23+
"react/jsx-uses-vars": 2,
24+
"react/self-closing-comp": 2
25+
}
26+
}

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('./eslintrc.json')

package.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"name": "eslint-config-standard-jsx",
3+
"description": "JavaScript Standard Style JSX support - ESLint Shareable Config",
4+
"version": "0.0.0",
5+
"author": {
6+
"name": "Feross Aboukhadijeh",
7+
"email": "feross@feross.org",
8+
"url": "http://feross.org/"
9+
},
10+
"bugs": {
11+
"url": "https://github.com/feross/eslint-config-standard-jsx/issues"
12+
},
13+
"peerDependencies": {
14+
"eslint-plugin-react": ">=2.7.1"
15+
},
16+
"devDependencies": {
17+
"tape": "^4.0.0"
18+
},
19+
"homepage": "https://github.com/feross/eslint-config-standard-jsx",
20+
"keywords": [
21+
"standard",
22+
"style checker",
23+
"code style",
24+
"code checker",
25+
"code linter",
26+
"style linter",
27+
"simple",
28+
"policy",
29+
"style",
30+
"code",
31+
"lint",
32+
"eslint",
33+
"eslintconfig",
34+
"jshint",
35+
"jscs",
36+
"hint",
37+
"enforce",
38+
"check",
39+
"verify",
40+
"quality",
41+
"checker",
42+
"code standards",
43+
"JavaScript Standard Style",
44+
"standard style",
45+
"jsx"
46+
],
47+
"license": "MIT",
48+
"main": "index.js",
49+
"repository": {
50+
"type": "git",
51+
"url": "git://github.com/feross/eslint-config-standard-jsx.git"
52+
},
53+
"scripts": {
54+
"test": "tape test/*.js"
55+
}
56+
}

test/basic.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var config = require('../')
2+
var test = require('tape')
3+
4+
test('test basic properties of config', function (t) {
5+
t.ok(isObject(config.parserOptions))
6+
t.ok(isObject(config.rules))
7+
t.ok(Array.isArray(config.plugins))
8+
t.end()
9+
})
10+
11+
function isObject (obj) {
12+
return typeof obj === 'object' && obj !== null
13+
}

0 commit comments

Comments
 (0)