Skip to content

Commit ab75a4f

Browse files
committed
chore: fix some lint errors
1 parent 205feef commit ab75a4f

File tree

8 files changed

+313
-271
lines changed

8 files changed

+313
-271
lines changed

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"editor.formatOnSave": true
3+
}

lib/.eslintrc.cjs

+13-2
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,30 @@
1919
const path = require('path');
2020

2121
module.exports = {
22-
extends: ['plugin:@wso2/typescript', 'plugin:@wso2/strict', 'plugin:@wso2/internal', 'plugin:@wso2/prettier'],
22+
extends: [
23+
'plugin:@wso2/typescript',
24+
'plugin:@wso2/strict',
25+
'plugin:@wso2/internal',
26+
'plugin:@wso2/prettier',
27+
'plugin:unicorn/recommended',
28+
],
2329
parserOptions: {
2430
project: [
2531
path.resolve(__dirname, 'tsconfig.lib.json'),
2632
path.resolve(__dirname, 'tsconfig.spec.json'),
2733
path.resolve(__dirname, 'tsconfig.eslint.json'),
2834
],
2935
},
30-
plugins: ['@wso2'],
36+
plugins: ['@wso2', 'unicorn'],
3137
rules: {
3238
'@typescript-eslint/explicit-function-return-type': 'off',
39+
'@typescript-eslint/explicit-module-boundary-types': 'off',
40+
'@typescript-eslint/no-non-null-assertion': 'off',
3341
'@typescript-eslint/no-throw-literal': 'off',
3442
'@typescript-eslint/no-useless-constructor': 'off',
43+
'no-unused-vars': 'off',
44+
'no-var': 'off',
45+
'prefer-const': 'off',
3546
'unicorn/filename-case': 'off',
3647
'unicorn/no-null': 'off',
3748
'unicorn/prefer-node-protocol': 'off',

lib/config/jest.config.ts

+25-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,34 @@
1-
import type { Config } from "@jest/types";
1+
/**
2+
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
3+
*
4+
* WSO2 LLC. licenses this file to you under the Apache License,
5+
* Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing,
12+
* software distributed under the License is distributed on an
13+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
* KIND, either express or implied. See the License for the
15+
* specific language governing permissions and limitations
16+
* under the License.
17+
*/
18+
19+
import * as path from 'path';
20+
import type {Config} from '@jest/types';
221
// eslint-disable-next-line unicorn/prefer-node-protocol
322
// eslint-disable-next-line unicorn/import-style
4-
import * as path from "path";
523

624
const config: Config.InitialOptions = {
725
verbose: Boolean(process.env.CI),
8-
rootDir: path.resolve("."),
9-
collectCoverageFrom: ["<rootDir>/src/**/*.ts"],
10-
setupFilesAfterEnv: ["<rootDir>/config/jest/setup.ts"],
11-
testMatch: ["<rootDir>/test/**/*.test.ts"],
26+
rootDir: path.resolve('.'),
27+
collectCoverageFrom: ['<rootDir>/src/**/*.ts'],
28+
setupFilesAfterEnv: ['<rootDir>/config/jest/setup.ts'],
29+
testMatch: ['<rootDir>/test/**/*.test.ts'],
1230
transform: {
13-
"\\.[jt]sx?$": [
14-
"babel-jest",
15-
{ configFile: "./config/jest/babel.config.js" },
16-
],
31+
'\\.[jt]sx?$': ['babel-jest', {configFile: './config/jest/babel.config.js'}],
1732
},
1833
};
1934

lib/config/jest/babel.config.js

+21-10
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,35 @@
11
/**
2-
* This Babel configuration is not being used by Remix to compiler our app.
3-
* The reason to configure Babel in our project is because Jest needs this
4-
* file to support JSX and TypeScript. This is also the reason why the
5-
* preset-env targets is only the current version of Node.js
2+
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
3+
*
4+
* WSO2 LLC. licenses this file to you under the Apache License,
5+
* Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing,
12+
* software distributed under the License is distributed on an
13+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
* KIND, either express or implied. See the License for the
15+
* specific language governing permissions and limitations
16+
* under the License.
617
*/
7-
/* eslint-disable unicorn/prefer-module */
18+
819
module.exports = {
920
presets: [
1021
[
11-
"@babel/preset-env",
22+
'@babel/preset-env',
1223
{
13-
targets: { node: "current" },
24+
targets: {node: 'current'},
1425
},
1526
],
1627
[
17-
"@babel/preset-react",
28+
'@babel/preset-react',
1829
{
19-
runtime: "automatic",
30+
runtime: 'automatic',
2031
},
2132
],
22-
"@babel/preset-typescript",
33+
'@babel/preset-typescript',
2334
],
2435
};

lib/config/jest/setup.ts

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
1-
import { installGlobals } from "@remix-run/node";
2-
import "jest-fetch-mock/setupJest";
1+
/**
2+
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
3+
*
4+
* WSO2 LLC. licenses this file to you under the Apache License,
5+
* Version 2.0 (the "License"); you may not use this file except
6+
* in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing,
12+
* software distributed under the License is distributed on an
13+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
* KIND, either express or implied. See the License for the
15+
* specific language governing permissions and limitations
16+
* under the License.
17+
*/
18+
19+
import {installGlobals} from '@remix-run/node';
20+
import 'jest-fetch-mock/setupJest';
321

422
installGlobals();

0 commit comments

Comments
 (0)