Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eslint 9 upgrade #1863

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/unreleased/INTERNAL-20241015-143216.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: INTERNAL
body: Upgrade eslint to v9
time: 2024-10-15T14:32:16.914035-04:00
custom:
Issue: "1863"
Repository: vscode-terraform
20 changes: 10 additions & 10 deletions .changie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ custom:
type: int
minInt: 1
kinds:
- label: ENHANCEMENTS
auto: minor
- label: BUG FIXES
auto: patch
- label: INTERNAL
auto: patch
- label: NOTES
auto: patch
- label: BREAKING CHANGES
auto: minor
- label: ENHANCEMENTS
auto: minor
- label: BUG FIXES
auto: patch
- label: INTERNAL
auto: patch
- label: NOTES
auto: patch
- label: BREAKING CHANGES
auto: minor
newlines:
afterKind: 1
beforeKind: 1
Expand Down
9 changes: 0 additions & 9 deletions .eslintignore

This file was deleted.

48 changes: 0 additions & 48 deletions .eslintrc.json

This file was deleted.

4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "Bug report"
description: "Let us know about an unexpected error, a crash, or an incorrect behavior."
name: 'Bug report'
description: 'Let us know about an unexpected error, a crash, or an incorrect behavior.'
labels: [bug]
assignees: []
body:
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/documentation.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "Documentation issue or request"
description: "Report an issue with our docs or Marketplace listing, or suggest additions and improvements to our documentation"
name: 'Documentation issue or request'
description: 'Report an issue with our docs or Marketplace listing, or suggest additions and improvements to our documentation'
labels: [documentation]
assignees: []
body:
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "Feature request"
description: "Suggest a new feature or other enhancement."
name: 'Feature request'
description: 'Suggest a new feature or other enhancement.'
labels: [enhancement]
assignees: []
body:
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/performance.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "Performance issue report"
description: "Let us know about issues with performance, such as slow speed or abnormally high CPU or memory usage."
name: 'Performance issue report'
description: 'Let us know about issues with performance, such as slow speed or abnormally high CPU or memory usage.'
labels: [performance]
assignees: []
body:
Expand Down
26 changes: 12 additions & 14 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
version: 2
updates:
- package-ecosystem: "npm"
- package-ecosystem: 'npm'
versioning-strategy: lockfile-only
directory: "/"
directory: '/'
schedule:
interval: "daily"
labels: ["dependencies"]
interval: 'daily'
labels: ['dependencies']
ignore:
- dependency-name: "@types/*"
update-types:
["version-update:semver-minor", "version-update:semver-patch"]
- dependency-name: "@typescript-eslint/*"
update-types:
["version-update:semver-minor", "version-update:semver-patch"]
- dependency-name: '@types/*'
update-types: ['version-update:semver-minor', 'version-update:semver-patch']
- dependency-name: '@typescript-eslint/*'
update-types: ['version-update:semver-minor', 'version-update:semver-patch']
# Dependabot only updates hashicorp GHAs, external GHAs are managed by internal tooling (tsccr)
- package-ecosystem: "github-actions"
directory: "/"
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: "daily"
interval: 'daily'
allow:
- dependency-name: "hashicorp/*"
- dependency-name: 'hashicorp/*'
2 changes: 1 addition & 1 deletion .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ changelog:
labels:
- dependencies
- ci
- "*"
- '*'
exclude:
labels:
- duplicate
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/add-copyright-headers.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Add Copyright Headers"
name: 'Add Copyright Headers'

on:
pull_request_target:
Expand Down
46 changes: 23 additions & 23 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
name: "Stale issues and pull requests"
name: 'Stale issues and pull requests'

permissions:
issues: write
pull-requests: write

on:
schedule:
- cron: "10 3 * * *"
- cron: '10 3 * * *'

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0
with:
only-labels: 'waiting-response'
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0
with:
only-labels: 'waiting-response'

days-before-stale: 30
stale-issue-label: 'stale'
stale-issue-message: |
Marking this issue as stale due to inactivity over the last 30 days. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next **30 days** it will automatically be closed. Maintainers can also remove the stale label.
days-before-stale: 30
stale-issue-label: 'stale'
stale-issue-message: |
Marking this issue as stale due to inactivity over the last 30 days. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next **30 days** it will automatically be closed. Maintainers can also remove the stale label.

Thank you for understanding.
stale-pr-label: 'stale'
stale-pr-message: |
Marking this pull request as stale due to inactivity over the last 30 days. This helps our maintainers find and focus on the active pull requests. If this pull request receives no comments in the next **30 days** it will automatically be closed. Maintainers can also remove the stale label.
Thank you for understanding.
stale-pr-label: 'stale'
stale-pr-message: |
Marking this pull request as stale due to inactivity over the last 30 days. This helps our maintainers find and focus on the active pull requests. If this pull request receives no comments in the next **30 days** it will automatically be closed. Maintainers can also remove the stale label.

Thank you for understanding.
Thank you for understanding.

days-before-close: 30
close-issue-message: |
Closing this issue due to its staleness.
days-before-close: 30
close-issue-message: |
Closing this issue due to its staleness.

If the issue was automatically closed and you feel it should be reopened, we encourage creating a new one linking back to this one for added context.
If the issue was automatically closed and you feel it should be reopened, we encourage creating a new one linking back to this one for added context.

Thank you!
close-pr-message: |
Closing this pull request due to its staleness.
Thank you!
close-pr-message: |
Closing this pull request due to its staleness.

If the pull request was automatically closed and you feel it should be reopened, we encourage creating a new one linking back to this one for added context.
If the pull request was automatically closed and you feel it should be reopened, we encourage creating a new one linking back to this one for added context.

Thank you!
Thank you!
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.changes
.vscode-test
.vscode-test-web
.wdio-vscode-service
Expand All @@ -10,3 +11,5 @@ snippets
src/test/fixtures
src/test/integration/*/workspace/**
syntaxes
docs
*.md
13 changes: 7 additions & 6 deletions .vscode-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ import path from 'path';
const BASE_SRC_PATH = './src/test/integration';
const BASE_OUT_PATH = './out/test/integration';

const testSuiteFolderNames = fs.readdirSync(BASE_SRC_PATH, { withFileTypes: true })
.filter(entry => entry.isDirectory()) // only directories ...
.filter(entry => fs.existsSync(path.join(BASE_SRC_PATH, entry.name, "workspace"))) // ... that contain a workspace folder are valid
.map(entry => entry.name);
const testSuiteFolderNames = fs
.readdirSync(BASE_SRC_PATH, { withFileTypes: true })
.filter((entry) => entry.isDirectory()) // only directories ...
.filter((entry) => fs.existsSync(path.join(BASE_SRC_PATH, entry.name, 'workspace'))) // ... that contain a workspace folder are valid
.map((entry) => entry.name);

const configs = testSuiteFolderNames.map(folderName => ({
const configs = testSuiteFolderNames.map((folderName) => ({
version: process.env['VSCODE_VERSION'] ?? 'stable',
workspaceFolder: process.env['VSCODE_WORKSPACE_FOLDER'] ?? path.join(BASE_SRC_PATH, folderName, "workspace"),
workspaceFolder: process.env['VSCODE_WORKSPACE_FOLDER'] ?? path.join(BASE_SRC_PATH, folderName, 'workspace'),
launchArgs: ['--disable-extensions', '--disable-workspace-trust'],
files: `${BASE_OUT_PATH}/${folderName}/*.test.js`,
mocha: {
Expand Down
3 changes: 1 addition & 2 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
.changie.yaml
.copywrite.hcl
.editorconfig
.eslintignore
.eslintrc.json
.eslint.config.mjs
.gitattributes
.github
.gitignore
Expand Down
43 changes: 22 additions & 21 deletions build/downloader.ts → build/downloader.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,24 @@
* SPDX-License-Identifier: MPL-2.0
*/

import * as fs from 'fs';
import * as path from 'path';
import * as releases from '@hashicorp/js-releases';
import axios from 'axios';
import { Buffer } from 'buffer';
import * as fs from 'fs';
import console from 'node:console';
import path from 'node:path';
import process from 'node:process';
import { fileURLToPath } from 'node:url';

async function fileFromUrl(url: string): Promise<Buffer> {
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

async function fileFromUrl(url) {
const response = await axios.get(url, { responseType: 'arraybuffer' });
return Buffer.from(response.data, 'binary');
}

function getPlatform(platform: string) {
function getPlatform(platform) {
if (platform === 'win32') {
return 'windows';
}
Expand All @@ -23,7 +30,7 @@ function getPlatform(platform: string) {
return platform;
}

function getArch(arch: string) {
function getArch(arch) {
// platform | terraform-ls | extension platform | vs code editor
// -- | -- | -- | --
// macOS | darwin_amd64 | darwin_x64 | ✅
Expand All @@ -42,17 +49,11 @@ function getArch(arch: string) {
return arch;
}

interface ExtensionInfo {
name: string;
extensionVersion: string;
languageServerVersion: string;
preview: false;
syntaxVersion: string;
}

function getExtensionInfo(): ExtensionInfo {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const pjson = require('../package.json');
function getExtensionInfo() {
const cwd = path.resolve(__dirname);
const buildDir = path.basename(cwd);
const repoDir = cwd.replace(buildDir, '');
const pjson = JSON.parse(fs.readFileSync(path.join(repoDir, 'package.json')));
return {
name: pjson.name,
extensionVersion: pjson.version,
Expand All @@ -62,7 +63,7 @@ function getExtensionInfo(): ExtensionInfo {
};
}

async function downloadLanguageServer(platform: string, architecture: string, extInfo: ExtensionInfo) {
async function downloadLanguageServer(platform, architecture, extInfo) {
const cwd = path.resolve(__dirname);

const buildDir = path.basename(cwd);
Expand Down Expand Up @@ -108,7 +109,7 @@ async function downloadLanguageServer(platform: string, architecture: string, ex
});
}

async function downloadFile(url: string, installPath: string) {
async function downloadFile(url, installPath) {
if (process.env.downloader_log === 'true') {
console.log(`Downloading: ${url}`);
}
Expand All @@ -120,7 +121,7 @@ async function downloadFile(url: string, installPath: string) {
}
}

async function downloadSyntax(info: ExtensionInfo) {
async function downloadSyntax(info) {
const release = `v${info.syntaxVersion}`;

const cwd = path.resolve(__dirname);
Expand Down Expand Up @@ -148,7 +149,7 @@ async function downloadSyntax(info: ExtensionInfo) {
await downloadFile(url, path.join(installPath, hclSyntaxFile));
}

async function run(platform: string, architecture: string) {
async function run(platform, architecture) {
const extInfo = getExtensionInfo();
if (process.env.downloader_log === 'true') {
console.log(extInfo);
Expand All @@ -175,7 +176,7 @@ if (lsTarget !== undefined) {
const tgt = lsTarget.split('_');
os = tgt[0];

arch = tgt[1] as NodeJS.Architecture;
arch = tgt[1];
}

run(os, arch);
Loading