Skip to content

Commit 289fc19

Browse files
committed
♻️ refactor: Convert to ES modules
Migrated the project to use ES modules by updating import statements and the eslint configuration. This modernizes the codebase and improves compatibility with newer JavaScript features.
1 parent 0de0ed1 commit 289fc19

File tree

3 files changed

+44
-29
lines changed

3 files changed

+44
-29
lines changed

dist/index.js

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

eslint.config.js

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
1-
import { defineConfig } from "eslint/config";
1+
import {defineConfig} from "eslint/config";
22
import globals from "globals";
33
import path from "node:path";
4-
import { fileURLToPath } from "node:url";
4+
import {fileURLToPath} from "node:url";
55
import js from "@eslint/js";
6-
import { FlatCompat } from "@eslint/eslintrc";
6+
import {FlatCompat} from "@eslint/eslintrc";
77

88
const __filename = fileURLToPath(import.meta.url);
99
const __dirname = path.dirname(__filename);
1010
const compat = new FlatCompat({
11-
baseDirectory: __dirname,
12-
recommendedConfig: js.configs.recommended,
13-
allConfig: js.configs.all
11+
baseDirectory: __dirname,
12+
recommendedConfig: js.configs.recommended,
13+
allConfig: js.configs.all
1414
});
1515

1616
export default defineConfig([{
17-
extends: compat.extends("eslint:recommended"),
18-
19-
languageOptions: {
20-
globals: {
21-
...globals.commonjs,
22-
...globals.node,
23-
},
24-
25-
ecmaVersion: 2018,
26-
sourceType: "commonjs",
17+
extends: compat.extends("eslint:recommended"),
18+
languageOptions: {
19+
globals: {
20+
...globals.commonjs,
21+
...globals.node,
2722
},
23+
ecmaVersion: 2018,
24+
sourceType: "module",
25+
},
2826

29-
rules: {},
30-
}]);
27+
rules: {},
28+
}]);

src/index.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
const core = require('@actions/core') // docs: https://github.com/actions/toolkit/tree/main/packages/core
2-
const tc = require('@actions/tool-cache') // docs: https://github.com/actions/toolkit/tree/main/packages/tool-cache
3-
const github = require('@actions/github') // docs: https://github.com/actions/toolkit/tree/main/packages/github
4-
const io = require('@actions/io') // docs: https://github.com/actions/toolkit/tree/main/packages/io
5-
const cache = require('@actions/cache') // docs: https://github.com/actions/toolkit/tree/main/packages/cache
6-
const exec = require('@actions/exec') // docs: https://github.com/actions/toolkit/tree/main/packages/exec
7-
const glob = require('@actions/glob') // docs: https://github.com/actions/toolkit/tree/main/packages/glob
8-
const semver = require('semver') // docs: https://github.com/npm/node-semver#readme
9-
const path = require('path')
10-
const os = require('os')
1+
import core from '@actions/core' // docs: https://github.com/actions/toolkit/tree/main/packages/core
2+
import tc from '@actions/tool-cache' // docs: https://github.com/actions/toolkit/tree/main/packages/tool-cache
3+
import github from '@actions/github' // docs: https://github.com/actions/toolkit/tree/main/packages/github
4+
import io from '@actions/io' // docs: https://github.com/actions/toolkit/tree/main/packages/io
5+
import cache from '@actions/cache' // docs: https://github.com/actions/toolkit/tree/main/packages/cache
6+
import exec from '@actions/exec' // docs: https://github.com/actions/toolkit/tree/main/packages/exec
7+
import glob from '@actions/glob' // docs: https://github.com/actions/toolkit/tree/main/packages/glob
8+
import semver from 'semver' // docs: https://github.com/npm/node-semver#readme
9+
import path from 'path'
10+
import os from 'os'
1111

1212
// read action inputs
1313
const input = {

0 commit comments

Comments
 (0)