Skip to content

Commit

Permalink
fix: airbnb-eslint 제거 #11
Browse files Browse the repository at this point in the history
  • Loading branch information
jinlee1703 committed Jan 21, 2024
1 parent 1304ea7 commit 9102223
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 127 deletions.
9 changes: 7 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{
"settings": {
"react": {
"version": "detect"
}
},
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "prettier"],
"extends": ["plugin:@typescript-eslint/recommended", "plugin:react/recommended", "plugin:prettier/recommended", "airbnb"],
"rules": {"prettier/prettier": ["error", { "endOfLine": "auto" }],"react/react-in-jsx-scope": "off"},
"extends": ["plugin:@typescript-eslint/recommended", "plugin:react/recommended", "plugin:prettier/recommended"],
"rules": {"prettier/prettier": ["error", { "endOfLine": "auto" }], "react/react-in-jsx-scope": "off"},
"ignorePatterns": ["craco.config.js"],
}
86 changes: 47 additions & 39 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,50 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
plugins: ['commitlint-plugin-function-rules'],
rules: {
// 스코프는 컨벤션과 맞지 않기에, 사용하지 않는 것으로 한다.
'scope-empty': [2, 'always'],
// 헤더의 길이는 50자로 제한한다.
'header-max-length': [2, 'always', 50],
// 본문의 한 줄은 72자로 제한한다.
'body-max-line-length': [2, 'always', 72],
// 타입은 아래의 태그만 사용하도록 한다.
'type-enum': [2, 'always', ['feat', 'fix', 'refactor', 'style', 'docs', 'test', 'chore']],
'subject-full-stop': [0],
'function-rules/subject-full-stop': [
2,
'always',
({ subject, header, body, raw }) => {
// 이슈 번호로 종료되는가?
if (subject && !/[^\.] #[0-9]+$/.test(subject))
return [false, 'subject는 issue 번호를 #[number] 형식으로 끝에 포함해야하며, .(점) 으로 끝나지 말아야 합니다.'];
extends: ['@commitlint/config-conventional'],
plugins: ['commitlint-plugin-function-rules'],
rules: {
// 스코프는 컨벤션과 맞지 않기에, 사용하지 않는 것으로 한다.
'scope-empty': [2, 'always'],
// 헤더의 길이는 50자로 제한한다.
'header-max-length': [2, 'always', 50],
// 본문의 한 줄은 72자로 제한한다.
'body-max-line-length': [2, 'always', 72],
// 타입은 아래의 태그만 사용하도록 한다.
'type-enum': [2, 'always', ['feat', 'fix', 'refactor', 'style', 'docs', 'test', 'chore']],
'subject-full-stop': [0],
'function-rules/subject-full-stop': [
2,
'always',
({ subject, header, body, raw }) => {
// 이슈 번호로 종료되는가?
if (subject && !/[^\.] #[0-9]+$/.test(subject)) {
return [
false,
'subject는 issue 번호를 #[number] 형식으로 끝에 포함해야하며, .(점) 으로 끝나지 말아야 합니다.',
];
}

// 제목과 바디가 공백으로 분리되어있는가?
if (body && raw && header && raw.search('\n\n') !== header.length)
return [false, '제목과 본문은 공백으로 구분해주시기 바랍니다.'];
// 제목과 바디가 공백으로 분리되어있는가?
if (body && raw && header && raw.search('\n\n') !== header.length) {
return [false, '제목과 본문은 공백으로 구분해주시기 바랍니다.'];
}

return [true];
}],
'body-leading-blank': [0],
'function-rules/body-leading-blank': [
2,
'always',
({ body }) => {
// body가 없으면 굳이 판단하지 않는다.
if (!body)
return [true];
if (body.split('\n').filter(line => !/ *-/.test(line)).length > 0)
return [false, '본문의 각 줄은 - 으로 시작해야 합니다.'];
return [true];
}
],
},
}
return [true];
},
],
'body-leading-blank': [0],
'function-rules/body-leading-blank': [
2,
'always',
({ body }) => {
// body가 없으면 굳이 판단하지 않는다.
if (!body) {
return [true];
}
if (body.split('\n').filter((line) => !/ *-/.test(line)).length > 0) {
return [false, '본문의 각 줄은 - 으로 시작해야 합니다.'];
}
return [true];
},
],
},
};
39 changes: 0 additions & 39 deletions src/App.css

This file was deleted.

6 changes: 3 additions & 3 deletions src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { render, screen } from '@testing-library/react';
import App from './App';

test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
23 changes: 9 additions & 14 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
import React from 'react';
import logo from './logo.svg';
import './App.css';

function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit
{' '}
<code>src/App.tsx</code>
{' '}
and save to reload.
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.tsx</code> and save to reload.
</p>
<a className="App-link" href="https://reactjs.org" target="_blank" rel="noopener noreferrer">
Learn React
<a className="App-link" href="https://reactjs.org" target="_blank" rel="noopener noreferrer">
Learn React
</a>
</header>
</div>
);
);
}

export default App;
13 changes: 0 additions & 13 deletions src/index.css

This file was deleted.

7 changes: 3 additions & 4 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
root.render(
<React.StrictMode>
<App />
</React.StrictMode>,
<React.StrictMode>
<App />
</React.StrictMode>
);

// If you want to start measuring performance in your app, pass a function
Expand Down
8 changes: 4 additions & 4 deletions src/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 9 additions & 9 deletions src/reportWebVitals.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { ReportHandler } from 'web-vitals';

const reportWebVitals = (onPerfEntry?: ReportHandler) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};

export default reportWebVitals;

0 comments on commit 9102223

Please sign in to comment.