Skip to content

Commit b21fd36

Browse files
committed
feat(lint): Switch to eslint-config-airbnb (#72)
`@benmvp/cli` was using [`eslint-config-eventbrite-react`](https://www.npmjs.com/package/eslint-config-eventbrite-react) for linting, but it's not regularly updated. As a result, greenkeeper kept submitting PRs to update various eslint-related packages, but we couldn't because `eslint-config-eventbrite-react` needed a certain version of `eslint`. The fix was to switch over to the industry standard [`eslint-config-airbnb`](https://www.npmjs.com/package/eslint-config-airbnb), which is more regularly updated and allows us to upgrade `eslint` to the latest version. Also: - Some of the eslint rules are different for the new config, so a bunch of files were fixed to pass the new styling rules. The biggest change was adding the space within object literals - Switching over to Github actions for CI & CD and removing Travis - Needed to add `react` & `react-dom` as dev dependencies because `enzyme-adapter-react-16` needs them because it does a `require('react')` inside (for some reason) - Temporarily removing typescript eslint rules that require type because there were issues around the `tsconfig.json` that I couldn't figure out. this was a result of the upgrade to v2 of `@typescript-eslint/eslint-plugin` - Removed `jest-environment-enzyme` in favor of including the adapter directly since I hadn't been able to get `enzyme` to passing type checking w/o importing it BREAKING CHANGE: Some of the eslint rules are different for the new config
1 parent 650c417 commit b21fd36

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+746
-510
lines changed

.github/pull_request_template.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## Problem
2+
3+
_State the problem the PR is aiming to solve_
4+
5+
6+
## Solution
7+
8+
_Outline the solution to the problem_
9+
10+
Fixes #.
11+
12+
13+
## Screenshots
14+
15+
_Embed any screenshots of the new UI_

.github/workflows/ci.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
name: Test (Node ${{ matrix.node }})
8+
runs-on: ubuntu-latest
9+
10+
strategy:
11+
matrix:
12+
node: [8, 10, 12, 13]
13+
14+
steps:
15+
- name: Checkout repo
16+
uses: actions/checkout@v1
17+
18+
- name: Use Node ${{ matrix.node }}
19+
uses: actions/setup-node@v1
20+
with:
21+
node-version: ${{ matrix.node }}
22+
23+
- name: Install NPM dependencies
24+
run: npm ci
25+
26+
- name: Run unit tests
27+
run: npm test
28+
env:
29+
CI: true
30+
31+
- name: Run integration tests
32+
run: npm run integrate
33+
env:
34+
CI: true

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
release:
10+
name: Release
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v1
16+
17+
- name: Use Node v12
18+
uses: actions/setup-node@v1
19+
with:
20+
node-version: 12
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Build package
26+
run: npm run build
27+
28+
- name: Release new version to NPM
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
32+
run: npx semantic-release

.travis.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@
22
"jest.enableInlineErrorMessages": false,
33
"jest.enableSnapshotPreviews": false,
44
"jest.enableSnapshotUpdateMessages": false,
5-
"jest.autoEnable": false,
6-
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
7-
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false
5+
"jest.autoEnable": false
86
}

integration-tests/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
{
22
"private": true,
3+
"dependencies": {
4+
"fs-extra": "^8.1.0",
5+
"react": "^16.9.0",
6+
"react-dom": "^16.9.0"
7+
},
38
"devDependencies": {
49
"@types/fs-extra": "^7.0.0",
510
"@types/react": "^16.9.2",
611
"@types/react-dom": "^16.8.5",
7-
"fs-extra": "^8.1.0",
8-
"react": "^16.9.0",
9-
"react-dom": "^16.9.0",
1012
"rimraf": "^3.0.0"
1113
}
1214
}

integration-tests/src/__tests__/build.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import {resolve} from 'path'
2-
import {promisify} from 'util'
3-
import {exec} from 'child_process'
4-
import {pathExists, readFile} from 'fs-extra'
1+
import { resolve } from 'path'
2+
import { promisify } from 'util'
3+
import { exec } from 'child_process'
4+
import { pathExists, readFile } from 'fs-extra'
55

66
const execAsync = promisify(exec)
77
const CWD = process.cwd()

integration-tests/src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import {resolve} from 'path'
2-
import {readFileSync} from 'fs-extra'
3-
import React from 'react'
4-
import {renderToStaticMarkup} from 'react-dom/server'
1+
import { resolve } from 'path'
2+
import { readFileSync } from 'fs-extra'
3+
import { createElement } from 'react'
4+
import { renderToStaticMarkup } from 'react-dom/server'
55

66
import Animal from './objects/animal'
77
import Snake from './objects/snake'
@@ -22,5 +22,5 @@ export const run = (): void => {
2222
console.log(PACKAGE_JSON)
2323

2424
// eslint-disable-next-line no-console
25-
console.log(renderToStaticMarkup(React.createElement(Counter)))
25+
console.log(renderToStaticMarkup(createElement(Counter)))
2626
}

integration-tests/src/objects/animal.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
export default class Animal {
22
private name: string
33

4-
public constructor (animalName: string) {
4+
public constructor(animalName: string) {
55
this.name = animalName
66
}
77

8-
public move (meters: number): void {
8+
public move(meters: number): void {
99
// eslint-disable-next-line no-console
1010
console.log(`${this.name} moved ${meters}m.`)
1111
}

integration-tests/src/objects/horse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Animal from './animal'
22

33
export default class Horse extends Animal {
4-
public move (): void {
4+
public move(): void {
55
// eslint-disable-next-line no-console
66
console.log('Galloping...')
77
super.move(45)

0 commit comments

Comments
 (0)