Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit70e1ff8

Browse files
authored
Merge pull request#170 from crazy-max/eslint
dev: switch to eslint
2 parentsf169e16 +0828e0e commit70e1ff8

16 files changed

+10230
-32448
lines changed

‎.eslintrc.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"env": {
3+
"node":true,
4+
"es2021":true,
5+
"jest/globals":true
6+
},
7+
"extends": [
8+
"eslint:recommended",
9+
"plugin:@typescript-eslint/recommended",
10+
"plugin:jest/recommended",
11+
"plugin:prettier/recommended"
12+
],
13+
"parser":"@typescript-eslint/parser",
14+
"parserOptions": {
15+
"ecmaVersion":"latest",
16+
"sourceType":"module"
17+
},
18+
"plugins": [
19+
"@typescript-eslint",
20+
"jest",
21+
"prettier"
22+
]
23+
}

‎__tests__/docker.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as exec from '@actions/exec';
66
process.env['RUNNER_TEMP']=path.join(__dirname,'runner');
77

88
test('loginStandard calls exec',async()=>{
9+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
910
//@ts-ignore
1011
constexecSpy=jest.spyOn(exec,'getExecOutput').mockImplementation(async()=>{
1112
return{
@@ -15,9 +16,9 @@ test('loginStandard calls exec', async () => {
1516
};
1617
});
1718

18-
constusername:string='dbowie';
19-
constpassword:string='groundcontrol';
20-
constregistry:string='https://ghcr.io';
19+
constusername='dbowie';
20+
constpassword='groundcontrol';
21+
constregistry='https://ghcr.io';
2122

2223
awaitloginStandard(registry,username,password);
2324

@@ -29,6 +30,7 @@ test('loginStandard calls exec', async () => {
2930
});
3031

3132
test('logout calls exec',async()=>{
33+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
3234
//@ts-ignore
3335
constexecSpy=jest.spyOn(exec,'getExecOutput').mockImplementation(async()=>{
3436
return{
@@ -38,7 +40,7 @@ test('logout calls exec', async () => {
3840
};
3941
});
4042

41-
constregistry:string='https://ghcr.io';
43+
constregistry='https://ghcr.io';
4244

4345
awaitlogout(registry);
4446

‎__tests__/main.test.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ import * as stateHelper from '../src/state-helper';
88
import*ascorefrom'@actions/core';
99

1010
test('errors without username and password',async()=>{
11-
constplatSpy=jest.spyOn(osm,'platform').mockImplementation(()=>'linux');
12-
11+
jest.spyOn(osm,'platform').mockImplementation(()=>'linux');
1312
process.env['INPUT_LOGOUT']='true';// default value
1413
constcoreSpy=jest.spyOn(core,'setFailed');
1514

@@ -18,21 +17,21 @@ test('errors without username and password', async () => {
1817
});
1918

2019
test('successful with username and password',async()=>{
21-
constplatSpy=jest.spyOn(osm,'platform').mockImplementation(()=>'linux');
20+
jest.spyOn(osm,'platform').mockImplementation(()=>'linux');
2221
constsetRegistrySpy=jest.spyOn(stateHelper,'setRegistry');
2322
constsetLogoutSpy=jest.spyOn(stateHelper,'setLogout');
2423
constdockerSpy=jest.spyOn(docker,'login').mockImplementation(jest.fn());
2524

26-
constusername:string='dbowie';
25+
constusername='dbowie';
2726
process.env[`INPUT_USERNAME`]=username;
2827

29-
constpassword:string='groundcontrol';
28+
constpassword='groundcontrol';
3029
process.env[`INPUT_PASSWORD`]=password;
3130

32-
constecr:string='auto';
31+
constecr='auto';
3332
process.env['INPUT_ECR']=ecr;
3433

35-
constlogout:boolean=false;
34+
constlogout=false;
3635
process.env['INPUT_LOGOUT']=String(logout);
3736

3837
awaitrun();
@@ -43,25 +42,25 @@ test('successful with username and password', async () => {
4342
});
4443

4544
test('calls docker login',async()=>{
46-
constplatSpy=jest.spyOn(osm,'platform').mockImplementation(()=>'linux');
45+
jest.spyOn(osm,'platform').mockImplementation(()=>'linux');
4746
constsetRegistrySpy=jest.spyOn(stateHelper,'setRegistry');
4847
constsetLogoutSpy=jest.spyOn(stateHelper,'setLogout');
4948
constdockerSpy=jest.spyOn(docker,'login');
5049
dockerSpy.mockImplementation(jest.fn());
5150

52-
constusername:string='dbowie';
51+
constusername='dbowie';
5352
process.env[`INPUT_USERNAME`]=username;
5453

55-
constpassword:string='groundcontrol';
54+
constpassword='groundcontrol';
5655
process.env[`INPUT_PASSWORD`]=password;
5756

58-
constregistry:string='ghcr.io';
57+
constregistry='ghcr.io';
5958
process.env[`INPUT_REGISTRY`]=registry;
6059

61-
constecr:string='auto';
60+
constecr='auto';
6261
process.env['INPUT_ECR']=ecr;
6362

64-
constlogout:boolean=true;
63+
constlogout=true;
6564
process.env['INPUT_LOGOUT']=String(logout);
6665

6766
awaitrun();

‎dev.Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# syntax=docker/dockerfile:1.3-labs
1+
# syntax=docker/dockerfile:1
22

33
ARG NODE_VERSION=12
4-
ARG DOCKER_VERSION=20.10.10
5-
ARG BUILDX_VERSION=0.7.0
4+
ARG DOCKER_VERSION=20.10.13
5+
ARG BUILDX_VERSION=0.8.1
66

77
FROM node:${NODE_VERSION}-alpine AS base
88
RUN apk add --no-cache cpio findutils git
@@ -57,10 +57,10 @@ RUN --mount=type=bind,target=.,rw \
5757
FROM scratch AS format-update
5858
COPY --from=format /out /
5959

60-
FROM deps ASformat-validate
60+
FROM deps ASlint
6161
RUN --mount=type=bind,target=.,rw \
6262
--mount=type=cache,target=/src/node_modules \
63-
yarn runformat-check
63+
yarn runlint
6464

6565
FROM docker:${DOCKER_VERSION} as docker
6666
FROM docker/buildx-bin:${BUILDX_VERSION} as buildx

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp