Skip to content

Commit

Permalink
Revert "Use Prettier 3.0 by default (#3069)"
Browse files Browse the repository at this point in the history
This reverts commit 2f99764.
  • Loading branch information
ntotten committed Jul 31, 2023
1 parent 23acb96 commit ad1d008
Show file tree
Hide file tree
Showing 32 changed files with 190 additions and 210 deletions.
1 change: 1 addition & 0 deletions .github/auto_assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ reviewers:
# A number of reviewers added to the pull request
# Set 0 to add all the reviewers (default: 0)
numberOfReviewers: 0

# A list of assignees, overrides reviewers if set
# assignees:
# - assigneeA
Expand Down
65 changes: 33 additions & 32 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ name: "CodeQL"

on:
push:
branches: ["main"]
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: ["main"]
branches: [ "main" ]
schedule:
- cron: "44 20 * * 4"
- cron: '44 20 * * 4'

jobs:
analyze:
Expand All @@ -32,42 +32,43 @@ jobs:
strategy:
fail-fast: false
matrix:
language: ["javascript"]
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
6 changes: 3 additions & 3 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# Source repository: https://github.com/actions/dependency-review-action
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
name: "Dependency Review"
name: 'Dependency Review'
on: [pull_request]

permissions:
Expand All @@ -14,7 +14,7 @@ jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: "Checkout Repository"
- name: 'Checkout Repository'
uses: actions/checkout@v3
- name: "Dependency Review"
- name: 'Dependency Review'
uses: actions/dependency-review-action@v3
3 changes: 0 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ All notable changes to the "prettier-vscode" extension will be documented in thi

## [Unreleased]

- Use Prettier 3.0 by default.
- Change default configuration for `trailingComma` to `all` to match Prettier 3.0.

## [9.19.0]

- Reverts change to `prettierPath` resolution. (#3045)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
},
"dependencies": {
"find-up": "5.0.0",
"prettier": "^3.0.0",
"prettier": "^2.8.8",
"resolve": "^1.22.2",
"semver": "^7.5.2",
"vscode-nls": "^5.2.0"
Expand Down Expand Up @@ -260,7 +260,7 @@
"es5",
"all"
],
"default": "all",
"default": "es5",
"markdownDescription": "%ext.config.trailingComma%",
"scope": "resource"
},
Expand Down
2 changes: 1 addition & 1 deletion scripts/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fs.readFile(CHANGELOG, (error, data) => {
const stringData = data.toString("utf8");
const updated = stringData.replace(
/## \[Unreleased\](?!\s*## )/, // None empty Unreleased block
`## [Unreleased]\n\n## [${v}]`,
`## [Unreleased]\n\n## [${v}]`
);

if (updated !== stringData) {
Expand Down
33 changes: 15 additions & 18 deletions src/BrowserModuleResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@ import {

import * as prettierStandalone from "prettier/standalone";

import * as angularPlugin from "prettier/plugins/angular";
import * as babelPlugin from "prettier/plugins/babel";
import * as glimmerPlugin from "prettier/plugins/glimmer";
import * as graphqlPlugin from "prettier/plugins/graphql";
import * as htmlPlugin from "prettier/plugins/html";
import * as markdownPlugin from "prettier/plugins/markdown";
import * as meriyahPlugin from "prettier/plugins/meriyah";
import * as typescriptPlugin from "prettier/plugins/typescript";
import * as yamlPlugin from "prettier/plugins/yaml";
// @ts-expect-error -- d.ts file missing estree plugin
import * as estreePlugin from "prettier/plugins/estree";
import * as angularPlugin from "prettier/parser-angular";
import * as babelPlugin from "prettier/parser-babel";
import * as glimmerPlugin from "prettier/parser-glimmer";
import * as graphqlPlugin from "prettier/parser-graphql";
import * as htmlPlugin from "prettier/parser-html";
import * as markdownPlugin from "prettier/parser-markdown";
import * as meriyahPlugin from "prettier/parser-meriyah";
import * as typescriptPlugin from "prettier/parser-typescript";
import * as yamlPlugin from "prettier/parser-yaml";

// commented out as the cod uses `new Function("return this") which
// is not allowed in the VS Code extension host as it enforces
Expand All @@ -34,7 +32,6 @@ import { getWorkspaceRelativePath } from "./util";
import { ResolveConfigOptions, Options } from "prettier";

const plugins = [
estreePlugin,
angularPlugin,
babelPlugin,
glimmerPlugin,
Expand All @@ -51,14 +48,14 @@ export class ModuleResolver implements ModuleResolverInterface {

public async getPrettierInstance(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_fileName: string,
_fileName: string
): Promise<PrettierModule | undefined> {
return this.getGlobalPrettierInstance();
}

public async getResolvedIgnorePath(
fileName: string,
ignorePath: string,
ignorePath: string
): Promise<string | undefined> {
return getWorkspaceRelativePath(fileName, ignorePath);
}
Expand Down Expand Up @@ -170,7 +167,7 @@ export class ModuleResolver implements ModuleResolverInterface {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
filePath: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
options?: PrettierFileInfoOptions,
options?: PrettierFileInfoOptions
): Promise<PrettierFileInfoResult> => {
// TODO: implement ignore file reading
return { ignored: false, inferredParser: null };
Expand All @@ -184,15 +181,15 @@ export class ModuleResolver implements ModuleResolverInterface {
resolveConfigFile(filePath?: string | undefined): Promise<string | null>;
resolveConfig(
fileName: string,
options?: ResolveConfigOptions | undefined,
options?: ResolveConfigOptions | undefined
): Promise<Options | null>;
},
// eslint-disable-next-line @typescript-eslint/no-unused-vars
uri: Uri,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
fileName: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
vscodeConfig: PrettierVSCodeConfig,
vscodeConfig: PrettierVSCodeConfig
): Promise<Options | "error" | "disabled" | null> {
return null;
}
Expand All @@ -201,7 +198,7 @@ export class ModuleResolver implements ModuleResolverInterface {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_doc: TextDocument,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_vscodeConfig: PrettierVSCodeConfig,
_vscodeConfig: PrettierVSCodeConfig
): Promise<"error" | "disabled" | PrettierOptions | null> {
return null;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function isWindows(): boolean {
* @param tracer the tracer to use
*/
export function resolveGlobalNodePath(
tracer?: (message: string) => void,
tracer?: (message: string) => void
): string | undefined {
let npmCommand = "npm";
const options: SpawnSyncOptionsWithStringEncoding = {
Expand All @@ -36,7 +36,7 @@ export function resolveGlobalNodePath(
const stdout = spawnSync(
npmCommand,
["config", "get", "prefix"],
options,
options
).stdout;

if (!stdout) {
Expand Down Expand Up @@ -77,7 +77,7 @@ interface YarnJsonFormat {
* @param tracer the tracer to use
*/
export function resolveGlobalYarnPath(
tracer?: (message: string) => void,
tracer?: (message: string) => void
): string | undefined {
let yarnCommand = "yarn";
const options: SpawnSyncOptionsWithStringEncoding = {
Expand All @@ -96,7 +96,7 @@ export function resolveGlobalYarnPath(
const results = spawnSync(
yarnCommand,
["global", "dir", "--json"],
options,
options
);

const stdout = results.stdout;
Expand Down
4 changes: 2 additions & 2 deletions src/ModuleLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function loadNodeModule<T>(moduleName: string): T | undefined {

export function resolveNodeModule(
moduleName: string,
options?: { paths: string[] },
options?: { paths: string[] }
) {
try {
return nodeModuleLoader().resolve(moduleName, options);
Expand All @@ -36,7 +36,7 @@ export function resolveNodeModule(
*/
export function resolveConfigPlugins(
config: PrettierOptions,
fileName: string,
fileName: string
): PrettierOptions {
if (config?.plugins?.length) {
config.plugins = config.plugins.map((plugin) => {
Expand Down

0 comments on commit ad1d008

Please sign in to comment.