Skip to content

Commit

Permalink
fix lint (#3160)
Browse files Browse the repository at this point in the history
  • Loading branch information
sealinesun committed May 19, 2018
1 parent bfe315b commit 5828b8c
Show file tree
Hide file tree
Showing 15 changed files with 624 additions and 551 deletions.
72 changes: 45 additions & 27 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,70 @@
"__DEV__": false
},
"parser": "babel-eslint",
"plugins": [
"react",
"prettier"
],
"plugins": ["react", "prettier"],
"rules": {
"max-len": "off",
"no-plusplus": "off",
"prefer-const": "off",
"one-var": "off",
"no-param-reassign": "off",
"no-mixed-operators": ["error", {
"groups": [
["&", "|", "^", "~", "<<", ">>", ">>>"],
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
["&&", "||"],
["in", "instanceof"]
],
"allowSamePrecedence": false
}],
"no-mixed-operators": [
"error",
{
"groups": [
["&", "|", "^", "~", "<<", ">>", ">>>"],
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
["&&", "||"],
["in", "instanceof"]
],
"allowSamePrecedence": false
}
],
"class-methods-use-this": "off",
"no-underscore-dangle": "off",
"prefer-destructuring": "off",
"jsx-a11y/no-noninteractive-element-interactions": "off",
"jsx-a11y/anchor-is-valid": "off",
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/mouse-events-have-key-events": "off",
"jsx-a11y/label-has-for": [
"error",
{ "required": { "some": ["nesting", "id"] } }
],
"react/forbid-prop-types": "off",
"react/jsx-boolean-value": 2,
"react/jsx-no-duplicate-props": 2,
"react/no-find-dom-node": "off",
"react/no-array-index-key": "off",
"react/no-string-refs": "off",
"react/prefer-stateless-function": "off",
"react/jsx-filename-extension": ["error", {
"extensions": [".js"]
}],
"react/prop-types": [2, { "ignore": [
"children",
"className",
"style",
"bsStyle",
"bsClass",
"bsSize"
]
}],
"react/default-props-match-prop-types": "off",
"react/jsx-filename-extension": [
"error",
{
"extensions": [".js"]
}
],
"react/prop-types": [
2,
{
"ignore": [
"children",
"className",
"style",
"bsStyle",
"bsClass",
"bsSize"
]
}
],
"react/require-default-props": "off",
"import/no-extraneous-dependencies": [
"error", {"devDependencies": ["!src/**/*.js"] }
"error",
{ "devDependencies": ["!src/**/*.js"] }
],
"no-restricted-syntax": ["error",
"no-restricted-syntax": [
"error",
"ForOfStatement",
"LabeledStatement",
"WithStatement"
Expand Down
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,30 +79,30 @@
"cross-env": "^2.0.0",
"enzyme": "^3.1.0",
"eslint": "^4.19.1",
"eslint-config-airbnb": "^15.1.0",
"eslint-config-airbnb": "^16.1.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-import": "^2.10.0",
"eslint-plugin-jsx-a11y": "^5.1.1",
"eslint-plugin-mocha": "^4.12.1",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-mocha": "^5.0.0",
"eslint-plugin-prettier": "^2.6.0",
"eslint-plugin-react": "^7.7.0",
"eslint-plugin-react": "^7.8.2",
"execa": "^0.10.0",
"fs-extra": "^5.0.0",
"fs-extra": "^6.0.1",
"husky": "^0.14.3",
"karma": "^2.0.0",
"karma": "^2.0.2",
"karma-chrome-launcher": "^2.2.0",
"karma-cli": "^1.0.1",
"karma-coverage": "^1.1.0",
"karma-coverage": "^1.1.2",
"karma-firefox-launcher": "^1.0.0",
"karma-mocha": "^1.1.1",
"karma-mocha-reporter": "^2.0.4",
"karma-sinon-chai": "^1.2.2",
"karma-sinon-chai": "^1.3.4",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^3.0.0",
"lint-staged": "^6.0.0",
"lodash": "^4.17.5",
"mocha": "^5.0.5",
"prettier": "^1.11.1",
"lint-staged": "^7.1.1",
"lodash": "^4.17.10",
"mocha": "^5.2.0",
"prettier": "^1.12.1",
"react": "^15.5.4",
"react-dom": "^15.5.4",
"react-test-renderer": "^15.6.2",
Expand Down
2 changes: 1 addition & 1 deletion test/BadgeSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('<Badge>', () => {
});

it('should hide with empty string', () => {
let instance = ReactTestUtils.renderIntoDocument(<Badge>{''}</Badge>);
let instance = ReactTestUtils.renderIntoDocument(<Badge />);
assert.ok(ReactDOM.findDOMNode(instance).className.match(/\bhidden\b/));
});

Expand Down
8 changes: 4 additions & 4 deletions test/NavSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,10 @@ describe('<Nav>', () => {
let instance;
let selectSpy = sinon.spy(activeKey => instance.setProps({ activeKey }));
instance = mount(
<Nav activeKey={''} onSelect={selectSpy} role="tablist">
<NavItem eventKey={'a'}>NavItem 1 content</NavItem>
<NavItem eventKey={'b'}>NavItem 2 content</NavItem>
<NavItem eventKey={''}>NavItem 3 content</NavItem>
<Nav activeKey="" onSelect={selectSpy} role="tablist">
<NavItem eventKey="a">NavItem 1 content</NavItem>
<NavItem eventKey="b">NavItem 2 content</NavItem>
<NavItem eventKey="">NavItem 3 content</NavItem>
</Nav>,
{ attachTo: mountPoint }
);
Expand Down
2 changes: 1 addition & 1 deletion www/src/components/PageFooter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import packageJSON from '../../../package.json';

let version = packageJSON.version;
let { version } = packageJSON;

if (/docs/.test(version)) {
version = version.split('-')[0];
Expand Down
6 changes: 3 additions & 3 deletions www/src/components/PropTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ class PropTable extends React.Component {
<td>
{doclets.deprecated && (
<div className="prop-desc-heading">
<strong className="text-danger">{`Deprecated: ${
doclets.deprecated
} `}</strong>
<strong className="text-danger">
{`Deprecated: ${doclets.deprecated} `}
</strong>
</div>
)}
{this.renderControllableNote(propData, name)}
Expand Down
6 changes: 4 additions & 2 deletions www/src/examples/CustomButtonStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ bootstrapUtils.addStyle(Button, 'custom');

const customButtonStyle = (
<div>
<style type="text/css">{`
<style type="text/css">
{`
.btn-custom {
background-color: purple;
color: white;
}
`}</style>
`}
</style>
<Button bsStyle="custom">Custom</Button>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion www/src/examples/NavDropdown.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class NavDropdownExample extends React.Component {
handleSelect(eventKey) {
handleSelect(eventKey, event) {
event.preventDefault();
alert(`selected ${eventKey}`);
}
Expand Down
2 changes: 1 addition & 1 deletion www/src/layouts/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const propTypes = {
function UtilitiesLayout({ children, ...props }) {
return (
<Default {...props}>
<PageHeader title="Utilities" subTitle={''} />
<PageHeader title="Utilities" subTitle="" />
<Main location={props.location}>{children()}</Main>
</Default>
);
Expand Down
2 changes: 1 addition & 1 deletion www/src/pages/components/dropdowns.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export default function DropdownSection({ data }) {
As a convenience Toggle and Menu components available as static
properties on the Dropdown component. However, you can also import
them directly, from the <code>/lib</code> directory like:{' '}
<code>{'require("react-bootstrap/lib/DropdownToggle")'}</code>.
<code>require("react-bootstrap/lib/DropdownToggle")</code>.
</p>
</div>
<ReactPlayground codeText={DropdownButtonCustom} />
Expand Down
2 changes: 1 addition & 1 deletion www/src/pages/components/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function ModalSection({ data }) {
The Modal Header, Title, Body, and Footer components are available as
static properties the <code>{'<Modal/>'}</code> component, but you can
also, import them directly from the <code>/lib</code> directory like:{' '}
<code>{'require("react-bootstrap/lib/ModalHeader")'}</code>.
<code>require("react-bootstrap/lib/ModalHeader")</code>.
</p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion www/src/pages/components/navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default function NavbarSection({ data }) {
available as static properties on the <code>{'<Navbar/>'}</code>{' '}
component but you can also import them directly from the{' '}
<code>/lib</code> directory like:{' '}
<code>{'require("react-bootstrap/lib/NavbarHeader")'}</code>.
<code>require("react-bootstrap/lib/NavbarHeader")</code>.
</p>
</div>

Expand Down
2 changes: 1 addition & 1 deletion www/src/pages/components/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default function PanelSection({ data }) {
<p>
Add any <code>&lt;Table /&gt;</code>, <code>&lt;ListGroup /&gt;</code>{' '}
to a panel for a seamless integration. Mix and match with{' '}
<code>{'Panel.Body'}</code> as needed.
<code>Panel.Body</code> as needed.
</p>
<ReactPlayground codeText={PanelListGroupFill} />

Expand Down
53 changes: 31 additions & 22 deletions www/src/pages/getting-started/introduction.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,19 @@ export default class Page extends React.Component {
<Col sm={6}>
<Panel header="npm (recommended)" className="bs-docs-code-panel">
<pre>
<code>{`
$ npm install --save react react-dom
$ npm install --save react-bootstrap
`}</code>
<code>
$ npm install --save react react-dom $ npm install --save
react-bootstrap
</code>
</pre>
</Panel>
</Col>
<Col sm={6}>
<Panel header="bower" className="bs-docs-code-panel">
<pre>
<code>{`
$ bower install react
$ bower install react-bootstrap
`}</code>
<code>
$ bower install react $ bower install react-bootstrap
</code>
</pre>
</Panel>
</Col>
Expand All @@ -55,13 +54,15 @@ $ bower install react-bootstrap
</p>
</div>
<pre>
<code>{`
<code>
{`
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
`}</code>
`}
</code>
</pre>
<p>
For more advanced use cases you can also use a bundler like Webpack
Expand Down Expand Up @@ -112,10 +113,10 @@ $ bower install react-bootstrap
<Anchor id="commonjs">CommonJS</Anchor>
</h3>
<pre>
<code>{`
var Alert = require('react-bootstrap/lib/Alert');
// or
var Alert = require('react-bootstrap').Alert;`}</code>
<code>
var Alert = require('react-bootstrap/lib/Alert'); // or var Alert
= require('react-bootstrap').Alert;
</code>
</pre>
/>
<h3>
Expand All @@ -126,10 +127,12 @@ var Alert = require('react-bootstrap').Alert;`}</code>
syntax now with the help of a transpiler like Babel.
</p>
<pre>
<code>{`
<code>
{`
import Button from 'react-bootstrap/lib/Button';
// or
import { Button } from 'react-bootstrap';`}</code>
import { Button } from 'react-bootstrap';`}
</code>
</pre>
<h3>
<Anchor id="amd">AMD</Anchor>
Expand All @@ -142,11 +145,13 @@ import { Button } from 'react-bootstrap';`}</code>
</p>
</div>
<pre>
<code>{`
<code>
{`
define(['react-bootstrap'], function(ReactBootstrap) {
var Alert = ReactBootstrap.Alert;
...
});`}</code>
});`}
</code>
</pre>
<h3>
<Anchor id="browser-globals">Browser globals</Anchor>
Expand All @@ -160,13 +165,15 @@ var Alert = ReactBootstrap.Alert;
in both the Bower and NPM packages.
</p>
<pre>
<code>{`
<code>
{`
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/<react-version>/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/<react-version>/react-dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-bootstrap/<version>/react-bootstrap.min.js"></script>
<script>
var Alert = ReactBootstrap.Alert;
</script>`}</code>
</script>`}
</code>
</pre>
</div>
<div className="bs-docs-section">
Expand Down Expand Up @@ -201,13 +208,15 @@ var Alert = ReactBootstrap.Alert;

<div className="highlight">
<pre>
<code>{`
<code>
{`
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv-printshiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/es5-shim/3.4.0/es5-shim.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/es5-shim/3.4.0/es5-sham.js"></script>
<![endif]-->`}</code>
<![endif]-->`}
</code>
</pre>
</div>
</div>
Expand Down
Loading

0 comments on commit 5828b8c

Please sign in to comment.