Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Biome instead of ESLint and Prettier #600

Merged
merged 7 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

30 changes: 0 additions & 30 deletions .eslintrc.yaml

This file was deleted.

18 changes: 3 additions & 15 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on:
- cron: '0 0 * * 0' # 0:00 UTC on every sunday

jobs:
eslint:
name: ESLint
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -19,19 +19,7 @@ jobs:
node-version: 'lts/*'
cache: npm
- run: npm ci
- run: npm run eslint

prettier:
name: Prettier
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
cache: npm
- run: npm ci
- run: npm run prettier
- run: npm run lint:ci

test:
name: Jest w/ react@${{ matrix.react.react-version }} @line/liff@${{ matrix.liff-sdk.sdk-version }}
Expand Down
5 changes: 0 additions & 5 deletions .prettierignore

This file was deleted.

2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

- [#599](https://github.com/epaew/react-liff/pull/599)
- Tests with `@line/[email protected]`.
- [#600](https://github.com/epaew/react-liff/pull/600)
- Use Biome instead of ESLint and Prettier.

# v2.1.0

Expand Down
5 changes: 2 additions & 3 deletions __mocks__/@line/liff.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Liff } from '@line/liff';
import { Liff } from "@line/liff";

type IdWritableLiff = Omit<Liff, 'id'> & { id: string | null };
type IdWritableLiff = Omit<Liff, "id"> & { id: string | null };

let loginState = false;

Expand All @@ -19,5 +19,4 @@ const liffMock: Partial<IdWritableLiff> = {
use: jest.fn(),
};

// eslint-disable-next-line import/no-default-export
export default liffMock;
18 changes: 18 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "https://biomejs.dev/schemas/1.3.3/schema.json",
"organizeImports": {
"enabled": true
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 120
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
}
4 changes: 0 additions & 4 deletions examples/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
"last 1 safari version"
]
},
"eslintConfig": {
"extends": "react-app",
"root": true
},
"dependencies": {
"@line/liff": "^2.20.2",
"@line/liff-mock": "^1.0.1",
Expand Down
24 changes: 15 additions & 9 deletions examples/simple/src/App.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React, { useEffect, useState } from 'react';
import logo from './logo.svg';
import './App.css';
import React, { useEffect, useState } from "react";
import "./App.css";
import logo from "./logo.svg";

import { useLiff } from 'react-liff';
import { useLiff } from "react-liff";

function App() {
const { error, isLoggedIn, isReady, liff } = useLiff();
const [displayName, setDisplayName] = useState('');
const [displayName, setDisplayName] = useState("");

useEffect(() => {
if (!isLoggedIn) return;
Expand All @@ -15,7 +15,7 @@ function App() {
const profile = await liff.getProfile();
setDisplayName(profile.displayName);
})();
});
}, [isLoggedIn, liff.getProfile]);

const loginHandler = () => {
liff.login();
Expand All @@ -29,15 +29,21 @@ function App() {
if (!isReady) return <p>Loading...</p>;

if (!isLoggedIn) {
return <button className="App-button" onClick={loginHandler}>Login</button>;
return (
<button className="App-button" onClick={loginHandler} type="submit">
Login
</button>
);
}
return (
<>
<p>Welcome to the react-liff demo app, {displayName}!</p>
<button className="App-button" onClick={logoutHandler}>Logout</button>
<button className="App-button" onClick={logoutHandler} type="submit">
Logout
</button>
</>
);
}
};

return (
<div className="App">
Expand Down
20 changes: 10 additions & 10 deletions examples/simple/src/index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { LiffMockPlugin } from '@line/liff-mock';
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import './index.css';
import App from './App';
import { LiffMockPlugin } from "@line/liff-mock";
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import App from "./App";
import "./index.css";

import { LiffProvider } from 'react-liff';
import { LiffProvider } from "react-liff";

const liffId = process.env.REACT_APP_LINE_LIFF_ID ?? '';
const mockEnabled = process.env.NODE_ENV !== 'production';
const liffId = process.env.REACT_APP_LINE_LIFF_ID ?? "";
const mockEnabled = process.env.NODE_ENV !== "production";
const liffPlugins = [new LiffMockPlugin()];

const root = createRoot(document.getElementById('root'));
const root = createRoot(document.getElementById("root"));
root.render(
<StrictMode>
<LiffProvider liffId={liffId} mock={mockEnabled} plugins={liffPlugins}>
<App />
</LiffProvider>
</StrictMode>
</StrictMode>,
);
11 changes: 5 additions & 6 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// eslint-disable-next-line import/no-default-export
export default {
collectCoverageFrom: ['<rootDir>/src/**/*.ts{,x}', '!<rootDir>/src/**/*.test.ts{,x}'],
collectCoverageFrom: ["<rootDir>/src/**/*.ts{,x}", "!<rootDir>/src/**/*.test.ts{,x}"],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
"^(\\.{1,2}/.*)\\.js$": "$1",
},
preset: 'ts-jest/presets/default-esm',
testEnvironment: 'jsdom',
preset: "ts-jest/presets/default-esm",
testEnvironment: "jsdom",
transform: {
'\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.test.json', useESM: true }],
"\\.tsx?$": ["ts-jest", { tsconfig: "tsconfig.test.json", useESM: true }],
},
};
Loading