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

fix: typo 'lifecycle' 'third' linted by textlint #1005

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

lumirlumir
Copy link
Collaborator

@lumirlumir lumirlumir commented Jul 16, 2024

안녕하세요😁 textlint에 의해 검사된 아래 2개의 키워드를 수정하였습니다.

용어 term 정규표현식 sources 번역 target 논의 discussions
Third /Third/, /써드/ 서드 #2
Lifecycle /Life\s?Cycle/, /라이프\s?사이클/, /생명 주기/ 생명주기 #2

특이사항

  1. '써드파티'를 '서드 파티'로 번역한 이유는 과거 textlint legacy 파일인 아래 내용을 따른 것입니다. (해당 부분은 추후에 보완하여 PR 올리도록 하겠습니다.)
더보기
/**
 * 외래어 표기 및 약속된 용어를 위한 규칙
 */
module.exports = function(context) {
  const {Syntax} = context;
  return {
    [Syntax.Str](node) {
      const {getSource, RuleError, report} = context;
      const text = getSource(node);

      for (const term of terms) {
        for (const expression of term.expressions) {
          let result;
          while ((result = expression.exec(text))) {
            report(
              node,
              new RuleError(term.message, {
                index: result.index,
              }),
            );
          }
        }
      }
    },
  };
};

/**
 * 전역 검색을 위한 일련의 정규표현식을 생성합니다.
 * @param {RegExp[]} args
 * @return {RegExp[]} 'g' 플래그가 설정된 일련의 정규표현식
 */
const g = args => args.map(arg => new RegExp(arg, 'g'));

/**
 * @typedef {Object} Terminology
 * @property {string} value - 올바른 용어
 * @property {RegExp[]} expressions - 올바르지 못한 용어에 대한 일련의 정규표현식
 * @property {string} message - 에러 메시지
 *
 * @type {Terminology[]}
 */
const terms = [
  {
    // http://www.korean.go.kr/front/onlineQna/onlineQnaView.do?mn_id=61&qna_seq=11976
    value: '메서드',
    expressions: [/메소드/, /메쏘드/],
    message: 'method는 메서드가 올바른 표현입니다',
  },
  {
    // https://opendict.korean.go.kr/dictionary/view?sense_no=1251028
    value: '서드 파티',
    expressions: [/서드파티/, /써드파티/, /써드 파티/],
    message: 'third party는 서드 파티가 올바른 표현입니다',
  },
  {
    value: '예시',
    expressions: [/예제/],
    message: 'example은 예시로 표현합니다.',
  },
  {
    value: '애플리케이션',
    expressions: [/응용프로그램/, /어플리케이션/],
    message: 'application은 애플리케이션으로 표현합니다.',
  },
  {
    value: '함수 컴포넌트',
    expressions: [/함수형 컴포넌트/],
    message: 'function(al) component는 함수 컴포넌트로 표현합니다.',
  },
  {
    value: '생명주기',
    expressions: [/라이프사이클/],
    message: 'life cycle은 생명주기로 표현합니다.',
  },
].map(term => ({...term, expressions: g(term.expressions)}));

Progress

Copy link

vercel bot commented Jul 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
ko-legacy-reactjs-org ⬜️ Ignored (Inspect) Visit Preview Jul 16, 2024 11:16am

Copy link

Size changes

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link
Member

@hg-pyun hg-pyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hg-pyun hg-pyun merged commit 7f5ff1e into reactjs:main Jul 16, 2024
5 checks passed
@lumirlumir lumirlumir deleted the typo-lifecycle branch July 16, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants