Update eslint from 8.x to 9.x (#185)
* remove eslint prettier plugins Signed-off-by: Brian DeHamer <[email protected]> * eslint upgrade Signed-off-by: Brian DeHamer <[email protected]> * source fixup Signed-off-by: Brian DeHamer <[email protected]> --------- Signed-off-by: Brian DeHamer <[email protected]>
This commit is contained in:
@@ -1,4 +0,0 @@
|
|||||||
lib/
|
|
||||||
dist/
|
|
||||||
node_modules/
|
|
||||||
coverage/
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
env:
|
|
||||||
node: true
|
|
||||||
es6: true
|
|
||||||
jest: true
|
|
||||||
|
|
||||||
globals:
|
|
||||||
Atomics: readonly
|
|
||||||
SharedArrayBuffer: readonly
|
|
||||||
|
|
||||||
ignorePatterns:
|
|
||||||
- '!.*'
|
|
||||||
- '**/node_modules/.*'
|
|
||||||
- '**/dist/.*'
|
|
||||||
- '**/coverage/.*'
|
|
||||||
- '*.json'
|
|
||||||
|
|
||||||
parser: '@typescript-eslint/parser'
|
|
||||||
|
|
||||||
parserOptions:
|
|
||||||
ecmaVersion: 2023
|
|
||||||
sourceType: module
|
|
||||||
project:
|
|
||||||
- './.github/linters/tsconfig.json'
|
|
||||||
- './tsconfig.json'
|
|
||||||
|
|
||||||
plugins:
|
|
||||||
- jest
|
|
||||||
- '@typescript-eslint'
|
|
||||||
|
|
||||||
extends:
|
|
||||||
- eslint:recommended
|
|
||||||
- plugin:@typescript-eslint/eslint-recommended
|
|
||||||
- plugin:@typescript-eslint/recommended
|
|
||||||
- plugin:github/recommended
|
|
||||||
- plugin:jest/recommended
|
|
||||||
|
|
||||||
rules:
|
|
||||||
{
|
|
||||||
'camelcase': 'off',
|
|
||||||
'eslint-comments/no-use': 'off',
|
|
||||||
'eslint-comments/no-unused-disable': 'off',
|
|
||||||
'i18n-text/no-en': 'off',
|
|
||||||
'import/no-namespace': 'off',
|
|
||||||
'import/no-unresolved': ['error', { 'ignore': ['csv-parse/sync'] }],
|
|
||||||
'no-console': 'off',
|
|
||||||
'no-unused-vars': 'off',
|
|
||||||
'prettier/prettier': 'error',
|
|
||||||
'semi': 'off',
|
|
||||||
'@typescript-eslint/array-type': 'error',
|
|
||||||
'@typescript-eslint/await-thenable': 'error',
|
|
||||||
'@typescript-eslint/ban-ts-comment': 'error',
|
|
||||||
'@typescript-eslint/consistent-type-assertions': 'error',
|
|
||||||
'@typescript-eslint/explicit-member-accessibility':
|
|
||||||
['error', { 'accessibility': 'no-public' }],
|
|
||||||
'@typescript-eslint/explicit-function-return-type':
|
|
||||||
['error', { 'allowExpressions': true }],
|
|
||||||
'@typescript-eslint/func-call-spacing': ['error', 'never'],
|
|
||||||
'@typescript-eslint/no-array-constructor': 'error',
|
|
||||||
'@typescript-eslint/no-empty-interface': 'error',
|
|
||||||
'@typescript-eslint/no-explicit-any': 'error',
|
|
||||||
'@typescript-eslint/no-extraneous-class': 'error',
|
|
||||||
'@typescript-eslint/no-for-in-array': 'error',
|
|
||||||
'@typescript-eslint/no-inferrable-types': 'error',
|
|
||||||
'@typescript-eslint/no-misused-new': 'error',
|
|
||||||
'@typescript-eslint/no-namespace': 'error',
|
|
||||||
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
||||||
'@typescript-eslint/no-require-imports': 'error',
|
|
||||||
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
|
||||||
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
|
||||||
'@typescript-eslint/no-unused-vars': 'error',
|
|
||||||
'@typescript-eslint/no-useless-constructor': 'error',
|
|
||||||
'@typescript-eslint/no-var-requires': 'error',
|
|
||||||
'@typescript-eslint/prefer-for-of': 'warn',
|
|
||||||
'@typescript-eslint/prefer-function-type': 'warn',
|
|
||||||
'@typescript-eslint/prefer-includes': 'error',
|
|
||||||
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
|
||||||
'@typescript-eslint/promise-function-async': 'error',
|
|
||||||
'@typescript-eslint/require-array-sort-compare': 'error',
|
|
||||||
'@typescript-eslint/restrict-plus-operands': 'error',
|
|
||||||
'@typescript-eslint/semi': ['error', 'never'],
|
|
||||||
'@typescript-eslint/space-before-function-paren': 'off',
|
|
||||||
'@typescript-eslint/type-annotation-spacing': 'error',
|
|
||||||
'@typescript-eslint/unbound-method': 'error'
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
import eslint from '@eslint/js'
|
||||||
|
import importplugin from 'eslint-plugin-import'
|
||||||
|
import jestplugin from 'eslint-plugin-jest'
|
||||||
|
import tseslint from 'typescript-eslint'
|
||||||
|
|
||||||
|
export default tseslint.config(
|
||||||
|
// Ignore non-project files
|
||||||
|
{
|
||||||
|
name: 'ignore',
|
||||||
|
ignores: ['.github', 'dist', 'coverage', '**/*.json', 'jest.setup.js']
|
||||||
|
},
|
||||||
|
// Use recommended rules from ESLint, TypeScript, and other plugins
|
||||||
|
eslint.configs.recommended,
|
||||||
|
tseslint.configs.recommendedTypeChecked,
|
||||||
|
jestplugin.configs['flat/recommended'],
|
||||||
|
importplugin.flatConfigs.recommended,
|
||||||
|
importplugin.flatConfigs.typescript,
|
||||||
|
// Override some rules
|
||||||
|
{
|
||||||
|
name: 'project-settings',
|
||||||
|
languageOptions: {
|
||||||
|
ecmaVersion: 2023,
|
||||||
|
parserOptions: {
|
||||||
|
project: ['./.github/linters/tsconfig.json', './tsconfig.json']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
// eslint rules
|
||||||
|
eqeqeq: ['error', 'smart'],
|
||||||
|
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
|
||||||
|
'no-console': 'off',
|
||||||
|
'no-implicit-globals': 'error',
|
||||||
|
'no-inner-declarations': 'error',
|
||||||
|
'no-invalid-this': 'error',
|
||||||
|
'no-return-assign': 'error',
|
||||||
|
'no-sequences': 'error',
|
||||||
|
'no-shadow': 'error',
|
||||||
|
'no-useless-concat': 'error',
|
||||||
|
'object-shorthand': ['error', 'always', { avoidQuotes: true }],
|
||||||
|
'one-var': ['error', 'never'],
|
||||||
|
'prefer-template': 'error',
|
||||||
|
|
||||||
|
// typescript-eslint rules
|
||||||
|
'@typescript-eslint/array-type': 'error',
|
||||||
|
'@typescript-eslint/consistent-type-assertions': 'error',
|
||||||
|
'@typescript-eslint/explicit-function-return-type': [
|
||||||
|
'error',
|
||||||
|
{ allowExpressions: true }
|
||||||
|
],
|
||||||
|
'@typescript-eslint/explicit-member-accessibility': [
|
||||||
|
'error',
|
||||||
|
{ accessibility: 'no-public' }
|
||||||
|
],
|
||||||
|
'@typescript-eslint/no-extraneous-class': 'error',
|
||||||
|
'@typescript-eslint/no-inferrable-types': 'error',
|
||||||
|
'@typescript-eslint/no-non-null-assertion': 'warn',
|
||||||
|
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
||||||
|
'@typescript-eslint/no-unsafe-argument': 'off',
|
||||||
|
'@typescript-eslint/no-unsafe-assignment': 'off',
|
||||||
|
'@typescript-eslint/no-useless-constructor': 'error',
|
||||||
|
'@typescript-eslint/prefer-for-of': 'warn',
|
||||||
|
'@typescript-eslint/prefer-function-type': 'warn',
|
||||||
|
'@typescript-eslint/prefer-includes': 'error',
|
||||||
|
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
||||||
|
'@typescript-eslint/promise-function-async': 'error',
|
||||||
|
'@typescript-eslint/require-array-sort-compare': 'error',
|
||||||
|
'@typescript-eslint/restrict-template-expressions': 'off',
|
||||||
|
|
||||||
|
// eslint-plugin-import rules
|
||||||
|
'import/extensions': 'error',
|
||||||
|
'import/first': 'error',
|
||||||
|
'import/no-absolute-path': 'error',
|
||||||
|
'import/no-commonjs': 'error',
|
||||||
|
'import/no-deprecated': 'warn',
|
||||||
|
'import/no-dynamic-require': 'error',
|
||||||
|
'import/no-extraneous-dependencies': 'error',
|
||||||
|
'import/no-mutable-exports': 'error',
|
||||||
|
'import/no-namespace': 'off',
|
||||||
|
'import/no-unresolved': ['error', { ignore: ['csv-parse/sync'] }],
|
||||||
|
'import/no-anonymous-default-export': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
allowAnonymousClass: false,
|
||||||
|
allowAnonymousFunction: false,
|
||||||
|
allowArray: true,
|
||||||
|
allowArrowFunction: false,
|
||||||
|
allowLiteral: true,
|
||||||
|
allowObject: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -13,7 +13,7 @@ describe('index', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
getBooleanInputMock.mockImplementation(() => false)
|
getBooleanInputMock.mockImplementation(() => false)
|
||||||
})
|
})
|
||||||
it('calls run when imported', async () => {
|
it('calls run when imported', () => {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||||
require('../src/index')
|
require('../src/index')
|
||||||
|
|
||||||
|
|||||||
@@ -232,7 +232,6 @@ describe('subjectFromInputs', () => {
|
|||||||
expect(subjects).toBeDefined()
|
expect(subjects).toBeDefined()
|
||||||
expect(subjects).toHaveLength(3)
|
expect(subjects).toHaveLength(3)
|
||||||
|
|
||||||
/* eslint-disable-next-line github/array-foreach */
|
|
||||||
subjects.forEach((subject, i) => {
|
subjects.forEach((subject, i) => {
|
||||||
expect(subject.name).toEqual(`${filename}-${i}`)
|
expect(subject.name).toEqual(`${filename}-${i}`)
|
||||||
expect(subject.digest).toEqual({ sha256: expectedDigest })
|
expect(subject.digest).toEqual({ sha256: expectedDigest })
|
||||||
|
|||||||
+4
-5
@@ -70868,7 +70868,7 @@ const inputs = {
|
|||||||
// undocumented -- not part of public interface
|
// undocumented -- not part of public interface
|
||||||
privateSigning: ['true', 'True', 'TRUE', '1'].includes(core.getInput('private-signing'))
|
privateSigning: ['true', 'True', 'TRUE', '1'].includes(core.getInput('private-signing'))
|
||||||
};
|
};
|
||||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
/* eslint-disable-next-line @typescript-eslint/no-floating-promises */
|
||||||
(0, main_1.run)(inputs);
|
(0, main_1.run)(inputs);
|
||||||
|
|
||||||
|
|
||||||
@@ -70975,7 +70975,7 @@ async function run(inputs) {
|
|||||||
core.setOutput('attestation-url', attestationURL(att.attestationID));
|
core.setOutput('attestation-url', attestationURL(att.attestationID));
|
||||||
}
|
}
|
||||||
if (inputs.showSummary) {
|
if (inputs.showSummary) {
|
||||||
logSummary(att);
|
await logSummary(att);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
@@ -71018,13 +71018,13 @@ const logAttestation = (subjects, attestation, sigstoreInstance) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
// Attach summary information to the GitHub Actions run
|
// Attach summary information to the GitHub Actions run
|
||||||
const logSummary = (attestation) => {
|
const logSummary = async (attestation) => {
|
||||||
const { attestationID } = attestation;
|
const { attestationID } = attestation;
|
||||||
if (attestationID) {
|
if (attestationID) {
|
||||||
const url = attestationURL(attestationID);
|
const url = attestationURL(attestationID);
|
||||||
core.summary.addHeading('Attestation Created', 3);
|
core.summary.addHeading('Attestation Created', 3);
|
||||||
core.summary.addList([`<a href="${url}">${url}</a>`]);
|
core.summary.addList([`<a href="${url}">${url}</a>`]);
|
||||||
core.summary.write();
|
await core.summary.write();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const tempDir = () => {
|
const tempDir = () => {
|
||||||
@@ -71199,7 +71199,6 @@ const getSubjectFromPath = async (subjectPath, subjectName) => {
|
|||||||
// Parse the list of subject paths
|
// Parse the list of subject paths
|
||||||
const subjectPaths = parseList(subjectPath).join('\n');
|
const subjectPaths = parseList(subjectPath).join('\n');
|
||||||
// Expand the globbed paths to a list of actual paths
|
// Expand the globbed paths to a list of actual paths
|
||||||
/* eslint-disable-next-line github/no-then */
|
|
||||||
const paths = await glob.create(subjectPaths).then(async (g) => g.glob());
|
const paths = await glob.create(subjectPaths).then(async (g) => g.glob());
|
||||||
// Filter path list to just the files (not directories)
|
// Filter path list to just the files (not directories)
|
||||||
const files = paths.filter(p => fs_1.default.statSync(p).isFile());
|
const files = paths.filter(p => fs_1.default.statSync(p).isFile());
|
||||||
|
|||||||
Generated
+1166
-2648
File diff suppressed because it is too large
Load Diff
+6
-8
@@ -27,7 +27,7 @@
|
|||||||
"ci-test": "jest",
|
"ci-test": "jest",
|
||||||
"format:write": "prettier --write **/*.ts",
|
"format:write": "prettier --write **/*.ts",
|
||||||
"format:check": "prettier --check **/*.ts",
|
"format:check": "prettier --check **/*.ts",
|
||||||
"lint:eslint": "npx eslint . -c ./.github/linters/.eslintrc.yml",
|
"lint:eslint": "npx eslint . -c ./.github/linters/eslint.config.mjs",
|
||||||
"lint:markdown": "npx markdownlint --config .github/linters/.markdown-lint.yml \"*.md\"",
|
"lint:markdown": "npx markdownlint --config .github/linters/.markdown-lint.yml \"*.md\"",
|
||||||
"lint": "npm run lint:eslint && npm run lint:markdown",
|
"lint": "npm run lint:eslint && npm run lint:markdown",
|
||||||
"package": "ncc build src/index.ts --license licenses.txt",
|
"package": "ncc build src/index.ts --license licenses.txt",
|
||||||
@@ -71,31 +71,29 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/attest": "^1.5.0",
|
"@actions/attest": "^1.5.0",
|
||||||
"@actions/core": "^1.11.1",
|
"@actions/core": "^1.11.1",
|
||||||
|
"@actions/github": "^6.0.0",
|
||||||
"@actions/glob": "^0.5.0",
|
"@actions/glob": "^0.5.0",
|
||||||
"@sigstore/oci": "^0.4.0",
|
"@sigstore/oci": "^0.4.0",
|
||||||
"csv-parse": "^5.6.0"
|
"csv-parse": "^5.6.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@eslint/js": "^9.16.0",
|
||||||
"@sigstore/mock": "^0.8.0",
|
"@sigstore/mock": "^0.8.0",
|
||||||
"@types/jest": "^29.5.14",
|
"@types/jest": "^29.5.14",
|
||||||
"@types/make-fetch-happen": "^10.0.4",
|
"@types/make-fetch-happen": "^10.0.4",
|
||||||
"@types/node": "^22.9.4",
|
"@types/node": "^22.9.4",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
||||||
"@typescript-eslint/parser": "^7.18.0",
|
|
||||||
"@vercel/ncc": "^0.38.3",
|
"@vercel/ncc": "^0.38.3",
|
||||||
"eslint": "^8.57.1",
|
"eslint": "^9.16.0",
|
||||||
"eslint-plugin-github": "^5.1.2",
|
"eslint-plugin-import": "^2.31.0",
|
||||||
"eslint-plugin-jest": "^28.9.0",
|
"eslint-plugin-jest": "^28.9.0",
|
||||||
"eslint-plugin-jsonc": "^2.18.2",
|
|
||||||
"eslint-plugin-prettier": "^5.2.1",
|
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"markdownlint-cli": "^0.43.0",
|
"markdownlint-cli": "^0.43.0",
|
||||||
"nock": "^13.5.6",
|
"nock": "^13.5.6",
|
||||||
"prettier": "^3.3.3",
|
"prettier": "^3.3.3",
|
||||||
"prettier-eslint": "^16.3.0",
|
|
||||||
"ts-jest": "^29.2.5",
|
"ts-jest": "^29.2.5",
|
||||||
"typescript": "^5.7.2",
|
"typescript": "^5.7.2",
|
||||||
|
"typescript-eslint": "^8.18.0",
|
||||||
"undici": "^5.28.4"
|
"undici": "^5.28.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -20,5 +20,5 @@ const inputs: RunInputs = {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
/* eslint-disable-next-line @typescript-eslint/no-floating-promises */
|
||||||
run(inputs)
|
run(inputs)
|
||||||
|
|||||||
+3
-3
@@ -85,7 +85,7 @@ export async function run(inputs: RunInputs): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (inputs.showSummary) {
|
if (inputs.showSummary) {
|
||||||
logSummary(att)
|
await logSummary(att)
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Fail the workflow run if an error occurs
|
// Fail the workflow run if an error occurs
|
||||||
@@ -153,14 +153,14 @@ const logAttestation = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Attach summary information to the GitHub Actions run
|
// Attach summary information to the GitHub Actions run
|
||||||
const logSummary = (attestation: AttestResult): void => {
|
const logSummary = async (attestation: AttestResult): Promise<void> => {
|
||||||
const { attestationID } = attestation
|
const { attestationID } = attestation
|
||||||
|
|
||||||
if (attestationID) {
|
if (attestationID) {
|
||||||
const url = attestationURL(attestationID)
|
const url = attestationURL(attestationID)
|
||||||
core.summary.addHeading('Attestation Created', 3)
|
core.summary.addHeading('Attestation Created', 3)
|
||||||
core.summary.addList([`<a href="${url}">${url}</a>`])
|
core.summary.addList([`<a href="${url}">${url}</a>`])
|
||||||
core.summary.write()
|
await core.summary.write()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ const getSubjectFromPath = async (
|
|||||||
const subjectPaths = parseList(subjectPath).join('\n')
|
const subjectPaths = parseList(subjectPath).join('\n')
|
||||||
|
|
||||||
// Expand the globbed paths to a list of actual paths
|
// Expand the globbed paths to a list of actual paths
|
||||||
/* eslint-disable-next-line github/no-then */
|
|
||||||
const paths = await glob.create(subjectPaths).then(async g => g.glob())
|
const paths = await glob.create(subjectPaths).then(async g => g.glob())
|
||||||
|
|
||||||
// Filter path list to just the files (not directories)
|
// Filter path list to just the files (not directories)
|
||||||
|
|||||||
Reference in New Issue
Block a user