mirror of
https://github.com/actions/setup-node.git
synced 2025-11-07 21:16:56 +00:00
fix: update ESLint configuration file extension and add Jest globals as a dev dependency
This commit is contained in:
parent
0b341692b6
commit
006364163b
8 changed files with 976 additions and 314 deletions
51
.eslintrc.cjs
Normal file
51
.eslintrc.cjs
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
// This is a reusable configuration file copied from https://github.com/actions/reusable-workflows/tree/main/reusable-configurations. Please don't make changes to this file as it's the subject of an automatic update.
|
||||||
|
module.exports = {
|
||||||
|
extends: [
|
||||||
|
'eslint:recommended',
|
||||||
|
'plugin:@typescript-eslint/recommended',
|
||||||
|
'plugin:eslint-plugin-jest/recommended',
|
||||||
|
'eslint-config-prettier'
|
||||||
|
],
|
||||||
|
parser: '@typescript-eslint/parser',
|
||||||
|
plugins: ['@typescript-eslint', 'eslint-plugin-node', 'eslint-plugin-jest'],
|
||||||
|
rules: {
|
||||||
|
'@typescript-eslint/no-require-imports': 'error',
|
||||||
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||||
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
|
'@typescript-eslint/no-empty-function': 'off',
|
||||||
|
'@typescript-eslint/ban-ts-comment': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'ts-ignore': 'allow-with-description'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'no-console': 'error',
|
||||||
|
'yoda': 'error',
|
||||||
|
'prefer-const': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
destructuring: 'all'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'no-control-regex': 'off',
|
||||||
|
'no-constant-condition': ['error', {checkLoops: false}],
|
||||||
|
'node/no-extraneous-import': 'error'
|
||||||
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ['**/*{test,spec}.ts'],
|
||||||
|
rules: {
|
||||||
|
'@typescript-eslint/no-unused-vars': 'off',
|
||||||
|
'jest/no-standalone-expect': 'off',
|
||||||
|
'jest/no-conditional-expect': 'off',
|
||||||
|
'no-console': 'off',
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
env: {
|
||||||
|
node: true,
|
||||||
|
es6: true,
|
||||||
|
'jest/globals': true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// This is a reusable configuration file copied from https://github.com/actions/reusable-workflows/tree/main/reusable-configurations. Please don't make changes to this file as it's the subject of an automatic update.
|
// This is a reusable configuration file copied from https://github.com/actions/reusable-workflows/tree/main/reusable-configurations. Please don't make changes to this file as it's the subject of an automatic update.
|
||||||
module.exports = {
|
export default {
|
||||||
extends: [
|
extends: [
|
||||||
'eslint:recommended',
|
'eslint:recommended',
|
||||||
'plugin:@typescript-eslint/recommended',
|
'plugin:@typescript-eslint/recommended',
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// This is a reusable configuration file copied from https://github.com/actions/reusable-workflows/tree/main/reusable-configurations. Please don't make changes to this file as it's the subject of an automatic update.
|
// This is a reusable configuration file copied from https://github.com/actions/reusable-workflows/tree/main/reusable-configurations. Please don't make changes to this file as it's the subject of an automatic update.
|
||||||
module.exports = {
|
export default {
|
||||||
printWidth: 80,
|
printWidth: 80,
|
||||||
tabWidth: 2,
|
tabWidth: 2,
|
||||||
useTabs: false,
|
useTabs: false,
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@ let rcFile: string;
|
||||||
describe('authutil tests', () => {
|
describe('authutil tests', () => {
|
||||||
const _runnerDir = path.join(__dirname, 'runner');
|
const _runnerDir = path.join(__dirname, 'runner');
|
||||||
|
|
||||||
let cnSpy: any;
|
let cnSpy: ReturnType<typeof jest.spyOn>;
|
||||||
let logSpy: any;
|
let logSpy: ReturnType<typeof jest.spyOn>;
|
||||||
let dbgSpy: any;
|
let dbgSpy: ReturnType<typeof jest.spyOn>;
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const randPath = path.join(Math.random().toString(36).substring(7));
|
const randPath = path.join(Math.random().toString(36).substring(7));
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import osm from 'os';
|
import osm from 'os';
|
||||||
import {fileURLToPath} from 'url';
|
import {fileURLToPath} from 'url';
|
||||||
|
import {jest, describe, beforeEach, afterEach, it, expect} from '@jest/globals';
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
@ -22,26 +23,26 @@ describe('main tests', () => {
|
||||||
let inputs = {} as any;
|
let inputs = {} as any;
|
||||||
let os = {} as any;
|
let os = {} as any;
|
||||||
|
|
||||||
let infoSpy: jest.SpyInstance;
|
let infoSpy: ReturnType<typeof jest.spyOn>;
|
||||||
let warningSpy: jest.SpyInstance;
|
let warningSpy: ReturnType<typeof jest.spyOn>;
|
||||||
let saveStateSpy: jest.SpyInstance;
|
let saveStateSpy: ReturnType<typeof jest.spyOn>;
|
||||||
let inSpy: jest.SpyInstance;
|
let inSpy: ReturnType<typeof jest.spyOn>;
|
||||||
let setOutputSpy: jest.SpyInstance;
|
let setOutputSpy: ReturnType<typeof jest.spyOn>;
|
||||||
let startGroupSpy: jest.SpyInstance;
|
let startGroupSpy: ReturnType<typeof jest.spyOn>;
|
||||||
let endGroupSpy: jest.SpyInstance;
|
let endGroupSpy: ReturnType<typeof jest.spyOn>;
|
||||||
|
|
||||||
let whichSpy: jest.SpyInstance;
|
let whichSpy: ReturnType<typeof jest.spyOn>;
|
||||||
|
|
||||||
let existsSpy: jest.SpyInstance;
|
let existsSpy: ReturnType<typeof jest.spyOn>;
|
||||||
|
|
||||||
let getExecOutputSpy: jest.SpyInstance;
|
let getExecOutputSpy: ReturnType<typeof jest.spyOn>;
|
||||||
|
|
||||||
let getNodeVersionFromFileSpy: jest.SpyInstance;
|
let getNodeVersionFromFileSpy: ReturnType<typeof jest.spyOn>;
|
||||||
let cnSpy: jest.SpyInstance;
|
let cnSpy: ReturnType<typeof jest.spyOn>;
|
||||||
let findSpy: jest.SpyInstance;
|
let findSpy: ReturnType<typeof jest.spyOn>;
|
||||||
let isCacheActionAvailable: jest.SpyInstance;
|
let isCacheActionAvailable: ReturnType<typeof jest.spyOn>;
|
||||||
|
|
||||||
let setupNodeJsSpy: jest.SpyInstance;
|
let setupNodeJsSpy: ReturnType<typeof jest.spyOn>;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
inputs = {};
|
inputs = {};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
// Jest setup file to ensure globals are available in ESM mode
|
|
||||||
import { jest } from '@jest/globals';
|
|
||||||
|
|
||||||
// Make jest available globally
|
|
||||||
globalThis.jest = jest;
|
|
||||||
1188
package-lock.json
generated
1188
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -12,8 +12,8 @@
|
||||||
"build": "ncc build -o dist/setup src/setup-node.ts && ncc build -o dist/cache-save src/cache-save.ts",
|
"build": "ncc build -o dist/setup src/setup-node.ts && ncc build -o dist/cache-save src/cache-save.ts",
|
||||||
"format": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --write \"**/*.{ts,yml,yaml}\"",
|
"format": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --write \"**/*.{ts,yml,yaml}\"",
|
||||||
"format-check": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --check \"**/*.{ts,yml,yaml}\"",
|
"format-check": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --check \"**/*.{ts,yml,yaml}\"",
|
||||||
"lint": "eslint --config ./.eslintrc.js \"**/*.ts\"",
|
"lint": "eslint --config ./.eslintrc.cjs \"**/*.ts\"",
|
||||||
"lint:fix": "eslint --config ./.eslintrc.js \"**/*.ts\" --fix",
|
"lint:fix": "eslint --config ./.eslintrc.cjs \"**/*.ts\" --fix",
|
||||||
"test": "node --experimental-vm-modules node_modules/.bin/jest --coverage",
|
"test": "node --experimental-vm-modules node_modules/.bin/jest --coverage",
|
||||||
"pre-checkin": "npm run format && npm run lint:fix && npm run build && npm test"
|
"pre-checkin": "npm run format && npm run lint:fix && npm run build && npm test"
|
||||||
},
|
},
|
||||||
|
|
@ -41,6 +41,7 @@
|
||||||
"uuid": "^11.1.0"
|
"uuid": "^11.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@jest/globals": "^30.2.0",
|
||||||
"@types/jest": "^29.5.14",
|
"@types/jest": "^29.5.14",
|
||||||
"@types/node": "^24.1.0",
|
"@types/node": "^24.1.0",
|
||||||
"@types/semver": "^7.5.8",
|
"@types/semver": "^7.5.8",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue