Skip to content

Commit 5cf23df

Browse files
authored
chore(deps): migrate to ESLint 9 and include planet code in linting (#5386)
1 parent 5469614 commit 5cf23df

File tree

6 files changed

+869
-2183
lines changed

6 files changed

+869
-2183
lines changed

.eslintignore

Lines changed: 0 additions & 6 deletions
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
1-
name: Auto-convert PO to JSON and commit
2-
3-
on:
4-
push:
5-
paths:
6-
- 'po/**/*.po'
7-
8-
jobs:
9-
convert-and-commit:
10-
runs-on: ubuntu-latest
11-
12-
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@v4
15-
with:
16-
persist-credentials: true
17-
fetch-depth: 0
18-
19-
- name: Set up Python
20-
uses: actions/setup-python@v5
21-
with:
22-
python-version: '3.x'
23-
24-
- name: Find changed .po files
25-
id: find_po
26-
run: |
27-
git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '^po/.*\.po$' > changed_po_files.txt || true
28-
cat changed_po_files.txt
29-
echo "po_files<<EOF" >> $GITHUB_OUTPUT
30-
echo "$(cat changed_po_files.txt)" >> $GITHUB_OUTPUT
31-
echo "EOF" >> $GITHUB_OUTPUT
32-
33-
- name: Run conversion script
34-
if: steps.find_po.outputs.po_files != ''
35-
run: |
36-
mkdir -p locales
37-
while IFS= read -r po_file; do
38-
echo "▶ Converting $po_file"
39-
python3 convert_po_to_json.py "$po_file" "locales"
40-
done < changed_po_files.txt
41-
42-
- name: Commit and push updated JSON
43-
if: steps.find_po.outputs.po_files != ''
44-
run: |
45-
git config --global user.name "github-actions[bot]"
46-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
47-
48-
git add locales/*.json
49-
50-
if git diff --cached --quiet; then
51-
echo "✅ No JSON changes to commit."
52-
else
53-
git commit -m "chore(i18n): auto-update JSON files from updated PO files"
54-
git push origin ${{ github.ref }}
55-
echo "🚀 Pushed updated JSON files."
56-
fi
1+
name: Auto-convert PO to JSON and commit
2+
3+
on:
4+
push:
5+
paths:
6+
- 'po/**/*.po'
7+
8+
jobs:
9+
convert-and-commit:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
with:
16+
persist-credentials: true
17+
fetch-depth: 0
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: '3.x'
23+
24+
- name: Find changed .po files
25+
id: find_po
26+
run: |
27+
git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '^po/.*\.po$' > changed_po_files.txt || true
28+
cat changed_po_files.txt
29+
echo "po_files<<EOF" >> $GITHUB_OUTPUT
30+
echo "$(cat changed_po_files.txt)" >> $GITHUB_OUTPUT
31+
echo "EOF" >> $GITHUB_OUTPUT
32+
33+
- name: Run conversion script
34+
if: steps.find_po.outputs.po_files != ''
35+
run: |
36+
mkdir -p locales
37+
while IFS= read -r po_file; do
38+
echo "▶ Converting $po_file"
39+
python3 convert_po_to_json.py "$po_file" "locales"
40+
done < changed_po_files.txt
41+
42+
- name: Commit and push updated JSON
43+
if: steps.find_po.outputs.po_files != ''
44+
run: |
45+
git config --global user.name "github-actions[bot]"
46+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
47+
48+
git add locales/*.json
49+
50+
if git diff --cached --quiet; then
51+
echo "✅ No JSON changes to commit."
52+
else
53+
git commit -m "chore(i18n): auto-update JSON files from updated PO files"
54+
git push origin ${{ github.ref }}
55+
echo "🚀 Pushed updated JSON files."
56+
fi

eslint.config.mjs

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import js from '@eslint/js';
2+
import globals from 'globals';
3+
import babelParser from '@babel/eslint-parser';
4+
import prettierConfig from 'eslint-config-prettier';
5+
6+
export default [
7+
js.configs.recommended,
8+
prettierConfig,
9+
{
10+
ignores: [
11+
'**/node_modules/**',
12+
'**/lib/**',
13+
'**/dist/**',
14+
'**/build/**',
15+
'**/coverage/**',
16+
'**/*.min.js',
17+
'**/bower_components/**',
18+
'**/planet/libs/**',
19+
],
20+
},
21+
{
22+
linterOptions: {
23+
reportUnusedDisableDirectives: 'off',
24+
},
25+
},
26+
{
27+
files: ['**/*.js', '**/*.mjs'],
28+
languageOptions: {
29+
ecmaVersion: 'latest',
30+
sourceType: 'script',
31+
parser: babelParser,
32+
parserOptions: {
33+
requireConfigFile: false,
34+
ecmaFeatures: {
35+
globalReturn: false,
36+
},
37+
},
38+
globals: {
39+
...globals.browser,
40+
...globals.node,
41+
...globals.jest,
42+
...globals.jquery,
43+
// Add specific Music Blocks globals if needed
44+
Logo: 'readonly',
45+
Blocks: 'readonly',
46+
Turtles: 'readonly',
47+
Activity: 'readonly',
48+
_: 'readonly', // i18n
49+
},
50+
},
51+
rules: {
52+
'no-console': 'off',
53+
'no-unused-vars': 'off',
54+
'no-use-before-define': 'off',
55+
'prefer-const': 'off',
56+
'no-undef': 'off',
57+
'no-redeclare': 'off',
58+
'semi': ['error', 'always'],
59+
'no-duplicate-case': 'error',
60+
'no-irregular-whitespace': 'warn',
61+
'no-prototype-builtins': 'off',
62+
'no-useless-escape': 'off',
63+
'no-inner-declarations': 'off',
64+
'no-constant-assign': 'off',
65+
'no-const-assign': 'off',
66+
'no-dupe-keys': 'off',
67+
'no-useless-catch': 'off',
68+
'no-loss-of-precision': 'off',
69+
},
70+
},
71+
];

0 commit comments

Comments
 (0)