Skip to content

Commit

Permalink
Bump lingui to v5 (#5349)
Browse files Browse the repository at this point in the history
* Bump lingui to v5

remove lingui macro, split into react/macro and core/macro
remove babel macro, replace with lingui macro plugin

* split lingui/macro imports into lingui/core/macro and lingui/react/macro

    perl -i -npe 's/@lingui\/macro/@lingui\/core\/macro/' src/**/*.*
    perl -i -npe 's/import { Trans,(.*) from ..lingui.core.macro/import { Trans } from '\''\@lingui\/react\/macro'\''; import {$1 from '\''\@lingui\/core\/macro/' src/**/*.*
    perl -i -npe 's/import { Trans } from ..lingui.core.macro/import { Trans } from '\''\@lingui\/react\/macro/' src/**/*.*
    perl -i -npe 's/; import/;
    import/' src/**/*.*
    npm run prettier

* lingui.config: use defineConfig

* Bump eslint, typescript-eslint; add eslint-plugin-lingui

and fix linter warnings, allow dependabot to update these again,
disable `lingui/no-expression-in-message` for now, too many warnings

* npm run gettext:extract gettext:compile
  • Loading branch information
himdel authored Dec 13, 2024
1 parent ce35f48 commit e818c4d
Show file tree
Hide file tree
Showing 203 changed files with 6,543 additions and 4,908 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
],
"plugins": [
"@babel/plugin-transform-runtime",
"babel-plugin-macros"
"@lingui/babel-plugin-lingui-macro"
]
}
7 changes: 6 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import eslint from '@eslint/js';
import prettierConfig from 'eslint-config-prettier';
import pluginLingui from 'eslint-plugin-lingui';
import reactPlugin from 'eslint-plugin-react';
import globals from 'globals';
import {
Expand All @@ -23,6 +24,7 @@ export default config(
...tsConfigs.recommended,
...tsConfigs.stylistic,
prettierConfig,
pluginLingui.configs['flat/recommended'],
{
files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],
plugins: {
Expand Down Expand Up @@ -55,12 +57,13 @@ export default config(
'eol-last': ['error', 'always'],
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_' },
{ argsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' },
],
'@typescript-eslint/consistent-type-imports': [
'error',
{ fixStyle: 'inline-type-imports' },
],
'lingui/no-expression-in-message': 'off',
'no-restricted-imports': [
'error',
{
Expand Down Expand Up @@ -105,6 +108,7 @@ export default config(
},
},
rules: {
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-var-requires': 'off',
},
},
Expand All @@ -130,6 +134,7 @@ export default config(
},
},
rules: {
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-var-requires': 'off',
},
},
Expand Down
11 changes: 6 additions & 5 deletions lingui.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
const po = require("@lingui/format-po").formatter({ lineNumbers: false });
import { defineConfig } from '@lingui/cli';
import { formatter } from '@lingui/format-po';

export default {
export default defineConfig({
catalogs: [
{
path: '<rootDir>/locale/{locale}',
include: ['<rootDir>/src'],
},
],
format: po,
locales: ['en', 'es', 'fr', 'ko', 'nl', 'ru', 'ja', 'zh'],
format: formatter({ lineNumbers: false }),
locales: ['en', 'es', 'fr', 'ja', 'ko', 'nl', 'ru', 'zh'],
sourceLocale: 'en',
};
});
2 changes: 1 addition & 1 deletion locale/en.js

Large diffs are not rendered by default.

Loading

0 comments on commit e818c4d

Please sign in to comment.