Skip to content

Commit

Permalink
Merge pull request #517 from nanasess/fix-eslint
Browse files Browse the repository at this point in the history
ESLint のルール修正
  • Loading branch information
chihiro-adachi authored Feb 9, 2022
2 parents 3d25c7d + e0c009e commit bf7d535
Show file tree
Hide file tree
Showing 14 changed files with 328 additions and 15,486 deletions.
26 changes: 16 additions & 10 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,30 @@
"env": {
"es6": true,
"browser": true,
"jquery": true
"jquery": true,
"node": true
},
"plugins": [
"plugins": [
"import"
],
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"prettier/@typescript-eslint",
"jquery"
],
"rules": {
"prettier/prettier": [
"error",
{
"singleQuote": true
}
]
"@typescript-eslint/no-var-requires": "off",
"camelcase": "off",
"space-in-parens": "off",
"quotes": "off",
"no-shadow-restricted-names": "off",
"no-prototype-builtins": "off",
"max-len": ["warn", {"code": 120}],
"space-before-function-paren": ["error", {
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}]
}
}
15 changes: 7 additions & 8 deletions data/eccube.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ require( "slick-carousel/slick/slick-theme.css" );
const max = checkItems.length;
let errorFlag = false;

// 必須項目のチェック
// 必須項目のチェック
for ( let cnt = 0; cnt < max; cnt++ ) {
if ( formElement.find( `input[name=${checkItems[ cnt ]}]` ).val() === "" ) {
errorFlag = true;
Expand Down Expand Up @@ -445,10 +445,9 @@ require( "slick-carousel/slick/slick-theme.css" );
// 商品一覧時
if ( eccube.hasOwnProperty( "productsClassCategories" ) ) {
classcat2 = eccube.productsClassCategories[ product_id ][ classcat_id1 ];
}
} else {

// 詳細表示時
else {
// 詳細表示時
classcat2 = eccube.classCategories[ classcat_id1 ];
}

Expand Down Expand Up @@ -481,10 +480,9 @@ require( "slick-carousel/slick/slick-theme.css" );
// 商品一覧時
if ( eccube.hasOwnProperty( "productsClassCategories" ) ) {
classcat2 = eccube.productsClassCategories[ product_id ][ classcat_id1 ][ `#${classcat_id2}` ];
}
} else {

// 詳細表示時
else {
// 詳細表示時
classcat2 = eccube.classCategories[ classcat_id1 ][ `#${classcat_id2}` ];
}

Expand Down Expand Up @@ -546,7 +544,8 @@ require( "slick-carousel/slick/slick-theme.css" );

// 商品規格
const $product_class_id_dynamic = $form.find( "[id^=product_class_id]" );
if ( classcat2 && typeof classcat2.product_class_id !== "undefined" && String( classcat2.product_class_id ).length >= 1 ) {
if ( classcat2 && typeof classcat2.product_class_id !== "undefined" &&
String( classcat2.product_class_id ).length >= 1 ) {
$product_class_id_dynamic.val( classcat2.product_class_id );
} else {
$product_class_id_dynamic.val( "" );
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/test/admin/contents/recommendsearch.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test, expect, chromium, Page } from '@playwright/test';
import { ZapClient, Mode, ContextType, Risk, HttpMessage } from '../../../utils/ZapClient';
import { ZapClient, Mode, ContextType } from '../../../utils/ZapClient';
import { ADMIN_DIR } from '../../../config/default.config';

const url = `/${ADMIN_DIR}contents/recommend.php`;
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/test/admin/ownersstore/plugin_install.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test.describe.serial('プラグイン管理の確認をします', () => {
file: pluginFile,
cwd: pluginPath
},
['PrefilterTransformPlugin.php', 'plugin_info.php']
[ 'PrefilterTransformPlugin.php', 'plugin_info.php' ]
);
});

Expand Down
3 changes: 2 additions & 1 deletion e2e-tests/test/front_guest/entry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ test.describe.serial('会員登録のテストをします', () => {
await expect(page.locator('#form1 >> tr:nth-child(7) > td')).toContainText(await page.locator('input[name=fax02]').inputValue());
await expect(page.locator('#form1 >> tr:nth-child(7) > td')).toContainText(await page.locator('input[name=fax03]').inputValue());
await expect(page.locator('#form1 >> tr:nth-child(8) > td')).toContainText(await page.locator('input[name=email]').inputValue());

// TODO 性別、職業、パスワードを忘れた時のヒント等の Type を作成する
await page.click('[alt=会員登録をする]');
});
Expand All @@ -116,7 +117,7 @@ test.describe.serial('会員登録のテストをします', () => {
await expect(await messages.json()).toContainEqual(expect.objectContaining(
{
subject: expect.stringContaining('会員登録のご完了'),
recipients: expect.arrayContaining([`<${email}>`])
recipients: expect.arrayContaining([ `<${email}>` ])
}
));
});
Expand Down
3 changes: 0 additions & 3 deletions e2e-tests/test/front_login/contact.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ const inputNames = [
'name01', 'name02', 'kana01', 'kana02', 'zip01', 'zip02', 'addr01', 'addr02',
'tel01', 'tel02', 'tel03'
] as const;
type InputName = {
[key in typeof inputNames[number]]?: string
};

const baseURL = 'https://ec-cube';
const url = baseURL + '/contact/index.php';
Expand Down
1 change: 1 addition & 0 deletions e2e-tests/test/front_login/products_list.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ test.describe.serial('商品一覧のテストをします', () => {
await page.waitForSelector('#undercolumn > form > div > div.listrightbloc > h3 > a');
const all_products = await page.locator('#undercolumn > form > div > div.listrightbloc > h3 > a').count();
expect(all_products).toBeLessThanOrEqual(50);

// see https://github.com/EC-CUBE/ec-cube2/pull/273
await expect(page.locator('#undercolumn > form > div > div.listrightbloc > h3 > a')).toContainText('アイスクリーム');
await expect(page.locator('#undercolumn > form > div > div.listrightbloc > h3 > a')).not.toContainText('おなべ');
Expand Down
12 changes: 6 additions & 6 deletions e2e-tests/test/installer/installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ test.describe.serial('インストーラのテストをします', () => {

test('step2 - データベースの設定をします', async () => {
await expect(page.locator('h2').first()).toHaveText('データベースの設定');
const DB = process.env.DB_TYPE == 'mysql' ? 'MySQL' : 'PostgreSQL';
let DB_SERVER = process.env.DB_SERVER;
let DB_PORT = process.env.DB_PORT;
let DB_NAME = process.env.DB_NAME || 'eccube_db';
let DB_USER = process.env.DB_USER || 'eccube_db_user';
let DB_PASSWORD = process.env.DB_PASSWORD || 'password';
const DB = process.env.DB_TYPE === 'mysql' ? 'MySQL' : 'PostgreSQL';
const DB_SERVER = process.env.DB_SERVER;
const DB_PORT = process.env.DB_PORT;
const DB_NAME = process.env.DB_NAME || 'eccube_db';
const DB_USER = process.env.DB_USER || 'eccube_db_user';
const DB_PASSWORD = process.env.DB_PASSWORD || 'password';
await page.selectOption('select[name=db_type]', { label: DB });
await page.fill('input[name=db_server]', DB_SERVER ?? 'postgres');
await page.fill('input[name=db_port]', DB_PORT ?? '5432');
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/utils/Progress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ export const intervalRepeater = async (callback: any, interval: number, page: Pa
await page.waitForTimeout(interval);
}
console.log('::endgroup::');
}
};
13 changes: 7 additions & 6 deletions e2e-tests/utils/ZapClient.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const ClientApi = require('zaproxy');
import ClientApi from 'zaproxy';
export const Mode = {
Safe: 'safe',
Protect: 'protect',
Standard: 'standard',
Standard: 'standard'

// Attack: 'attack' denger!!
} as const;
type Mode = typeof Mode[keyof typeof Mode];
Expand Down Expand Up @@ -67,7 +68,7 @@ export type Alert = {
export class ZapClientError extends Error {
constructor(message?: string) {
super(message);
};
}
}

export class ZapClient {
Expand All @@ -77,8 +78,8 @@ export class ZapClient {
private readonly zaproxy;

constructor(proxy?: string, apiKey?: string | null) {
this.proxy = proxy != undefined ? proxy : `http://${process.env.HTTP_PROXY}`;
this.apiKey = apiKey != undefined ? apiKey : null;
this.proxy = proxy !== undefined ? proxy : `http://${process.env.HTTP_PROXY}`;
this.apiKey = apiKey !== undefined ? apiKey : null;
this.zaproxy = new ClientApi({
apiKey: this.apiKey,
proxy: this.proxy
Expand Down Expand Up @@ -137,7 +138,7 @@ export class ZapClient {
}

public async activeScan(url: string, recurse?: boolean, inScopeOnly?: boolean, scanPolicyName?: string | null, method?: 'GET' | 'POST' | 'PUT' | 'DELETE', postData?: string | null, contextId?: number | null): Promise<number> {
const result = await this.zaproxy.ascan.scan(url, recurse ?? false, inScopeOnly ?? true, scanPolicyName ?? null, method ?? 'GET', postData ?? null, contextId ?? null)
const result = await this.zaproxy.ascan.scan(url, recurse ?? false, inScopeOnly ?? true, scanPolicyName ?? null, method ?? 'GET', postData ?? null, contextId ?? null);
return result.scan;
}

Expand Down
37 changes: 2 additions & 35 deletions html/js/eccube.js

Large diffs are not rendered by default.

Loading

0 comments on commit bf7d535

Please sign in to comment.