Skip to content

Commit e818c4d

Browse files
authored
Bump lingui to v5 (#5349)
* 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
1 parent ce35f48 commit e818c4d

File tree

203 files changed

+6543
-4908
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

203 files changed

+6543
-4908
lines changed

.babelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
],
77
"plugins": [
88
"@babel/plugin-transform-runtime",
9-
"babel-plugin-macros"
9+
"@lingui/babel-plugin-lingui-macro"
1010
]
1111
}

eslint.config.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import eslint from '@eslint/js';
22
import prettierConfig from 'eslint-config-prettier';
3+
import pluginLingui from 'eslint-plugin-lingui';
34
import reactPlugin from 'eslint-plugin-react';
45
import globals from 'globals';
56
import {
@@ -23,6 +24,7 @@ export default config(
2324
...tsConfigs.recommended,
2425
...tsConfigs.stylistic,
2526
prettierConfig,
27+
pluginLingui.configs['flat/recommended'],
2628
{
2729
files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],
2830
plugins: {
@@ -55,12 +57,13 @@ export default config(
5557
'eol-last': ['error', 'always'],
5658
'@typescript-eslint/no-unused-vars': [
5759
'error',
58-
{ argsIgnorePattern: '^_' },
60+
{ argsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' },
5961
],
6062
'@typescript-eslint/consistent-type-imports': [
6163
'error',
6264
{ fixStyle: 'inline-type-imports' },
6365
],
66+
'lingui/no-expression-in-message': 'off',
6467
'no-restricted-imports': [
6568
'error',
6669
{
@@ -105,6 +108,7 @@ export default config(
105108
},
106109
},
107110
rules: {
111+
'@typescript-eslint/no-require-imports': 'off',
108112
'@typescript-eslint/no-var-requires': 'off',
109113
},
110114
},
@@ -130,6 +134,7 @@ export default config(
130134
},
131135
},
132136
rules: {
137+
'@typescript-eslint/no-require-imports': 'off',
133138
'@typescript-eslint/no-var-requires': 'off',
134139
},
135140
},

lingui.config.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
const po = require("@lingui/format-po").formatter({ lineNumbers: false });
1+
import { defineConfig } from '@lingui/cli';
2+
import { formatter } from '@lingui/format-po';
23

3-
export default {
4+
export default defineConfig({
45
catalogs: [
56
{
67
path: '<rootDir>/locale/{locale}',
78
include: ['<rootDir>/src'],
89
},
910
],
10-
format: po,
11-
locales: ['en', 'es', 'fr', 'ko', 'nl', 'ru', 'ja', 'zh'],
11+
format: formatter({ lineNumbers: false }),
12+
locales: ['en', 'es', 'fr', 'ja', 'ko', 'nl', 'ru', 'zh'],
1213
sourceLocale: 'en',
13-
};
14+
});

locale/en.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)