Skip to content

Commit

Permalink
FFE-130 Upgrade eslint to use latest ffe config
Browse files Browse the repository at this point in the history
  • Loading branch information
kwltrs committed Dec 29, 2016
1 parent 1425875 commit 995a1a2
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 96 deletions.
79 changes: 1 addition & 78 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,80 +1,3 @@
{
"env": {
"es6": true,
"browser": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 6,
"ecmaFeatures": {
"arrowFunctions": true,
"experimentalObjectRestSpread": true,
"jsx": true
},
"sourceType": "module"
},
"plugins": [
"react"
],
"globals": {
"describe": true,
"beforeEach": true,
"before": true,
"it": true
},
"rules": {
"arrow-spacing": 2,
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
"block-scoped-var": 2,
"camelcase": 2,
"comma-style": [2, "last"],
"curly": [2, "multi-line"],
"jsx-quotes": [2, "prefer-double"],
"linebreak-style": [2,"unix"],
"no-caller": 2,
"no-cond-assign": [2, "except-parens"],
"no-console": 1,
"no-constant-condition": 1,
"no-debugger": 2,
"no-empty": 2,
"no-eval": 2,
"no-extend-native": 2,
"no-irregular-whitespace": 2,
"no-iterator": 2,
"no-loop-func": 2,
"no-multi-str": 2,
"no-multiple-empty-lines": [2, {"max": 3, "maxEOF": 1}],
"no-new": 2,
"no-proto": 2,
"no-script-url": 2,
"no-sequences": 2,
"no-undef": 2,
"no-unused-vars": [2, { "vars": "all", "args": "none" }],
"no-with": 2,
"object-curly-spacing": [2, "always"],
"react/jsx-curly-spacing": [2, "always"],
"react/jsx-boolean-value": [2, "always"],
"react/jsx-no-duplicate-props": 2,
"react/jsx-no-undef": 2,
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/no-danger": 2,
"react/no-did-update-set-state": 1,
"react/no-direct-mutation-state": 2,
"react/no-multi-comp": 1,
"react/no-unknown-property": 2,
"react/react-in-jsx-scope": 2,
"react/self-closing-comp": 2,
"semi": [2, "always"],
"keyword-spacing": [2, {"before": true, "after": true}],
"space-before-function-paren": [2, "never"],
"space-before-blocks": [2, "always"],
"strict": 2,
"valid-typeof": 2,

// new
"dot-notation": [2, { "allowKeywords": true }],
"quotes": [2, "single"]
}
"extends": "ffe"
}
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v0.4.2 (27.12.2016)

* Update eslint configuraton to use latest ffe config.

## v0.4.1 (24.10.2016)

* Fix bug where `aria-invalid` was set to `undefined` if not provided, instead of `false`.
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ffe-radio-button-react",
"version": "0.4.1",
"version": "0.4.2",
"main": "lib/index.js",
"scripts": {
"build": "babel -d lib/. --ignore=*.test.js src/.",
Expand All @@ -20,8 +20,11 @@
"chai": "^3.5.0",
"chai-enzyme": "^0.4.2",
"enzyme": "^2.0.0",
"eslint": "^2.4.0",
"eslint-plugin-react": "^4.2.2",
"eslint": "^3.12.2",
"eslint-config-ffe": "^6.0.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^3.0.2",
"eslint-plugin-react": "^6.8.0",
"jsdom": "^8.4.1",
"mocha": "^2.4.5",
"mocha-tap13": "0.0.3",
Expand Down
31 changes: 18 additions & 13 deletions src/radio-base.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/*eslint-env mocha*/
/*eslint no-unused-expressions:0*/
import React from 'react';
import chai, { expect } from 'chai';
import chaiEnzyme from 'chai-enzyme';
Expand All @@ -11,21 +13,24 @@ chai.use(chaiEnzyme());
describe('<RadioBase />', () => {

describe('rendering', () => {
const wrapper = shallow(<RadioBase labelClasses="" value="shark" label="Kjempetorsk" />);

it('should render an input with type radio', () => {
expect(wrapper).to.have.exactly(1).descendants('input');
expect(wrapper.find('input').prop('type')).to.equal('radio');
});
describe('default', () => {
const wrapper = shallow(<RadioBase labelClasses="" value="shark" label="Kjempetorsk" />);

it('should render a label', () => {
expect(wrapper).to.have.exactly(1).descendants('label');
});
it('should render an input with type radio', () => {
expect(wrapper).to.have.exactly(1).descendants('input');
expect(wrapper.find('input').prop('type')).to.equal('radio');
});

it('should render a label', () => {
expect(wrapper).to.have.exactly(1).descendants('label');
});

it('should apply the same id to <label> and <input>', () => {
const htmlFor = wrapper.find('label').prop('htmlFor');
const id = wrapper.find('input').prop('id');
expect(htmlFor).to.be.equal(id);
it('should apply the same id to <label> and <input>', () => {
const htmlFor = wrapper.find('label').prop('htmlFor');
const id = wrapper.find('input').prop('id');
expect(htmlFor).to.be.equal(id);
});
});

it('should render a default value if passed', () => {
Expand All @@ -45,7 +50,7 @@ describe('<RadioBase />', () => {
});

it('should apply labelClasses to the label', () => {
let wrapper = shallow(<RadioBase labelClasses="test-class" value="" />);
const wrapper = shallow(<RadioBase labelClasses="test-class" value="" />);
expect(wrapper.find('label').hasClass('test-class')).to.be.true;
});
});
Expand Down
6 changes: 4 additions & 2 deletions src/radio-button-group.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/*eslint no-unused-expressions:0*/
/*eslint-env mocha*/
import React from 'react';
import chai, { expect } from 'chai';
import chaiEnzyme from 'chai-enzyme';
Expand Down Expand Up @@ -27,8 +29,8 @@ describe('<RadioButtonGroup />', () => {
expect(wrapper.find('legend')).to.be.empty;

it('should render a legend when specified', () => {
const wrapper = shallow(<RadioButtonGroup label="Wazzup" />);
const legend = wrapper.find('legend');
const wrapperWithLabel = shallow(<RadioButtonGroup label="Wazzup" />);
const legend = wrapperWithLabel.find('legend');
expect(legend).to.have.lengthOf(1);
expect(legend.text()).to.be.equal('Wazzup');
});});
Expand Down
2 changes: 2 additions & 0 deletions src/radio-switch.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/*eslint no-unused-expressions:0*/
/*eslint-env mocha*/
import React from 'react';
import chai, { expect } from 'chai';
import chaiEnzyme from 'chai-enzyme';
Expand Down

0 comments on commit 995a1a2

Please sign in to comment.