Skip to content
This repository was archived by the owner on Jun 3, 2023. It is now read-only.

Commit 33ba323

Browse files
committed
chore: run linters
1 parent c26cec8 commit 33ba323

File tree

8 files changed

+458
-185
lines changed

8 files changed

+458
-185
lines changed

.github/renovate.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{
2-
"extends": ["config:base"],
3-
"schedule": ["every month"]
4-
}
1+
{
2+
"extends": ["config:base"],
3+
"schedule": ["every month"]
4+
}

.github/workflows/ci.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: CI
2-
on:
3-
push
2+
on: push
43

54
jobs:
65
ci:
@@ -20,6 +19,10 @@ jobs:
2019
if: ${{ matrix.node == 'with-node' }}
2120
- name: Install Dependencies
2221
run: yarn install
22+
- name: Run Linters
23+
run: yarn lint
24+
- name: Format Check
25+
run: yarn format
2326
- name: Build Package
2427
run: yarn build
2528
- name: Run Action

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
## 🧠 Why
1212

13-
There is an excellent action already: [firebase-action](https://github.com/w9jds/firebase-action), but it forces you to run a command in order to work.
13+
There is an excellent action already: [firebase-action](https://github.com/w9jds/firebase-action), but it forces you to
14+
run a command in order to work.
1415

1516
With this one, after running the action you can use the firebase-tools CLI from anywhere: npm script, shell...
1617

@@ -30,17 +31,16 @@ jobs:
3031
firebase-token: YOUR_TOKEN
3132
```
3233
33-
By default, it will try to download the package from npm,
34-
if it fails because npm is not installed, or it doesn't have sufficient permissions,
35-
the action will fallback to download it using `curl`.
34+
By default, it will try to download the package from npm, if it fails because npm is not installed, or it doesn't have
35+
sufficient permissions, the action will fallback to download it using `curl`.
3636

3737
If you are running it on Windows you will need to use actions/setup-node before in order to work.
3838

3939
## ⚙ Inputs
4040

41-
**Name**|**Description**|**Required**
42-
-----|-----|-----
43-
firebase-token|Firebase token you can get by running `firebase login:ci`|✔
41+
| **Name** | **Description** | **Required** |
42+
| -------------- | --------------------------------------------------------- | ------------ |
43+
| firebase-token | Firebase token you can get by running `firebase login:ci` | ✔ |
4444

4545
## 👋 Support
4646

package.json

+22-25
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
"main": "lib/main.js",
66
"scripts": {
77
"build": "tsc && yarn run package",
8-
"lint": "eslint src --ext .tsx,.js,.ts",
9-
"lint:fix": "yarn lint --fix",
8+
"lint": "eslint . --ext ts,tsx",
9+
"lint:fix": "eslint . --ext ts,tsx --fix",
10+
"format": "prettier --check .",
11+
"format:fix": "prettier --write .",
1012
"package": "ncc build --source-map --license licenses.txt",
1113
"test": "jest"
1214
},
@@ -28,33 +30,20 @@
2830
"command-exists": "^1.2.9"
2931
},
3032
"devDependencies": {
31-
"@pocket-studios/eslint-config": "1.1.0",
33+
"@pocket-studios/eslint-config": "2.1.3",
34+
"@pocket-studios/prettier-config": "1.0.0",
3235
"@types/command-exists": "1.2.0",
3336
"@types/jest": "26.0.13",
3437
"@types/node": "14.6.2",
35-
"@typescript-eslint/eslint-plugin": "3.6.1",
36-
"@typescript-eslint/parser": "3.7.1",
3738
"@vercel/ncc": "0.24.0",
38-
"eslint": "6.8.0",
39-
"eslint-config-airbnb": "18.2.0",
40-
"eslint-plugin-cypress": "2.11.1",
41-
"eslint-plugin-import": "2.22.0",
42-
"eslint-plugin-jest": "23.20.0",
43-
"eslint-plugin-jsx-a11y": "6.3.1",
44-
"eslint-plugin-react": "7.20.0",
45-
"eslint-plugin-react-hooks": "4.0.0",
46-
"eslint-plugin-unused-imports": "0.1.3",
39+
"eslint": "7.2.0",
40+
"prettier": "2.1.2",
4741
"husky": "4.2.5",
4842
"jest": "26.4.2",
4943
"lint-staged": "10.2.13",
5044
"ts-jest": "26.3.0",
5145
"typescript": "4.0.2"
5246
},
53-
"eslintConfig": {
54-
"extends": [
55-
"@pocket-studios/eslint-config"
56-
]
57-
},
5847
"jest": {
5948
"testMatch": [
6049
"<rootDir>/tests/**/*.ts"
@@ -69,13 +58,21 @@
6958
},
7059
"husky": {
7160
"hooks": {
72-
"pre-push": "lint-staged"
61+
"pre-commit": "lint-staged"
7362
}
7463
},
7564
"lint-staged": {
76-
"*.{ts,js,tsx}": [
77-
"yarn lint:fix",
78-
"yarn lint"
65+
"*.(js|ts|tsx)": [
66+
"eslint --fix"
67+
],
68+
"*.+(js|jsx|json|yml|yaml|css|less|scss|ts|tsx|md|graphql|mdx)": [
69+
"prettier --write"
7970
]
80-
}
81-
}
71+
},
72+
"eslintConfig": {
73+
"extends": [
74+
"@pocket-studios/eslint-config"
75+
]
76+
},
77+
"prettier": "@pocket-studios/prettier-config"
78+
}

src/main.ts

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
import { execSync } from 'child_process';
2-
import * as core from '@actions/core';
3-
import commandExists from 'command-exists';
1+
import { execSync } from 'child_process'
2+
import * as core from '@actions/core'
3+
import commandExists from 'command-exists'
44

5-
const installNpm = () => execSync('npm install -g firebase-tools');
6-
const installBash = () => execSync('curl -sL https://firebase.tools | bash');
5+
const installNpm = () => execSync('npm install -g firebase-tools')
6+
const installBash = () => execSync('curl -sL https://firebase.tools | bash')
77

88
const run = async () => {
9-
const token = core.getInput('firebase-token');
10-
const os = process.env.RUNNER_OS;
9+
const token = core.getInput('firebase-token')
10+
const os = process.env.RUNNER_OS
1111

1212
if (!token) {
13-
throw new Error('Missing mandatory input: firebase-token');
13+
throw new Error('Missing mandatory input: firebase-token')
1414
}
1515

16-
core.exportVariable('FIREBASE_TOKEN', token);
17-
core.info('Exported environment variable FIREBASE_TOKEN');
16+
core.exportVariable('FIREBASE_TOKEN', token)
17+
core.info('Exported environment variable FIREBASE_TOKEN')
1818

1919
if (await commandExists('npm')) {
20-
core.info('Detected NPM installation');
20+
core.info('Detected NPM installation')
2121
try {
22-
core.info('Trying to install firebase-tools using NPM');
23-
installNpm();
22+
core.info('Trying to install firebase-tools using NPM')
23+
installNpm()
2424
} catch (e) {
25-
core.info('Installation failed through NPM (maybe you forgot actions/setup-node before this action)');
26-
core.info('Trying BASH instead');
27-
installBash();
25+
core.info('Installation failed through NPM (maybe you forgot actions/setup-node before this action)')
26+
core.info('Trying BASH instead')
27+
installBash()
2828
}
2929
} else if (os === 'Linux' || os === 'macOS') {
30-
core.info('Trying to install firebase-tools using BASH');
31-
installBash();
30+
core.info('Trying to install firebase-tools using BASH')
31+
installBash()
3232
} else if (os === 'Windows') {
33-
throw new Error('On windows you must setup node before running this action');
33+
throw new Error('On windows you must setup node before running this action')
3434
}
35-
};
35+
}
3636

3737
run()
3838
.then(() => core.info('Successfully installed firebase-tools CLI'))
39-
.catch(error => core.setFailed(error.message));
39+
.catch(error => core.setFailed(error.message))

tests/enviroment.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import commandExists from 'command-exists';
1+
import commandExists from 'command-exists'
22

33
test('environment variable was set correctly', () => {
4-
const token = process.env.FIREBASE_TOKEN;
4+
const token = process.env.FIREBASE_TOKEN
55

6-
expect(token).not.toBeUndefined();
7-
expect(token).not.toBeNull();
8-
expect(token).toBe('banana');
9-
});
6+
expect(token).not.toBeUndefined()
7+
expect(token).not.toBeNull()
8+
expect(token).toBe('banana')
9+
})
1010

1111
test('firebase tools cli is installed', async () => {
12-
expect(await commandExists('firebase')).toBe('firebase');
13-
});
12+
expect(await commandExists('firebase')).toBe('firebase')
13+
})

0 commit comments

Comments
 (0)