Skip to content

Commit

Permalink
Update typescript and eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
k2snowman69 committed Jan 26, 2025
1 parent eb3bf1d commit 287c04b
Show file tree
Hide file tree
Showing 28 changed files with 427 additions and 597 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Updated our typescript parsing dependencies
- [email protected]
- [email protected]
- Fixed potential bug when sortContents is enabled, member functions aren't sorted

## [2.0.2] - 2023-09-30

- Fixed files with special characters not being recognized (ex. `./src/[...something].ts`)
Expand Down
634 changes: 324 additions & 310 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dependencies": {
"@types/estree": "~1.0.0",
"@types/postcss-less": "^4.0.0",
"@typescript-eslint/typescript-estree": "^5.8.0",
"@typescript-eslint/typescript-estree": "^8.0.0",
"angular-html-parser": "^8.0.0",
"cosmiconfig": "^9.0.0",
"find-up": "^7.0.0",
Expand All @@ -22,13 +22,13 @@
"@release-it/keep-a-changelog": "6.0.0",
"@snowcoders/renovate-config": "3.0.0-beta.17",
"@types/node": "22.10.10",
"@typescript-eslint/eslint-plugin": "5.62.0",
"@typescript-eslint/parser": "5.62.0",
"@typescript-eslint/eslint-plugin": "8.21.0",
"@typescript-eslint/parser": "8.21.0",
"changelog-updater": "2.0.3",
"concurrently": "9.1.2",
"cpy-cli": "5.0.0",
"docsify-cli": "4.4.4",
"eslint": "8.57.1",
"eslint": "9.19.0",
"eslint-config-prettier": "10.0.1",
"eslint-plugin-import": "2.31.0",
"eslint-plugin-prettier": "5.2.3",
Expand Down Expand Up @@ -74,7 +74,6 @@
"husky:pre-commit": "npx --no lint-staged",
"husky:pre-push": "npm test",
"lint": "eslint --fix ./src/**/*.{js,jsx,ts,tsx}",
"prepare": "npm run clean && npm run build && npx --no-install husky",
"start": "npm run start:cli",
"start:cli": "node bin/index.js",
"start:docs": "concurrently \"npm:start:docs-*\"",
Expand Down
2 changes: 1 addition & 1 deletion src-playground/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ Source code for the playground found on the docs site.

The folder "mocks" contains mock files that we use to replace real files during the webpack build. This is done to either remove dependencies on node apis (ex. cosmiconfig) or remove functionality we don't use in the web (ex. flow-parser).

Anything within a folder is mocking a node_module. For example "src-playground/mocks/cosmiconfig/dist/index.js" is the mock for "node_modules/cosmiconfig/dist/index.js". These files are dynamically included in the webpack build via the webpack.config.js file.
Anything within a folder is mocking a node_module. For example "src-playground/mocks/cosmiconfig/dist/index.js" is the mock for "node_modules/cosmiconfig/dist/index.js". These files are dynamically included in the webpack build via the webpack.config.js file. It's also important to note that the mocked file needs to match the "module" type defined in the packge.json it's replacing. This is why you'll find some files written in cjs and others in esm.

Any files at the root is mocking a node API. These files are dynamically included in the webpack build via the webpack.config.js file.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const createIsolatedProgram = () => {};
exports.createIsolatedProgram = () => {};
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const createProjectProgram = () => {};
exports.createProjectProgram = () => {};
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const createProjectService = () => {};
exports.createProjectService = () => {};
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {};
exports = {};
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const ts = require("typescript");
exports.getScriptKind = function (filePath, jsx) {
const extension = filePath.slice(filePath.lastIndexOf(".")).toLowerCase();
// note - we only respect the user's jsx setting for unknown extensions
// this is so that we always match TS's internal script kind logic, preventing
// weird errors due to a mismatch.
// https://github.com/microsoft/TypeScript/blob/da00ba67ed1182ad334f7c713b8254fba174aeba/src/compiler/utilities.ts#L6948-L6968
switch (extension) {
case ts.Extension.Cjs:
case ts.Extension.Js:
case ts.Extension.Mjs:
return ts.ScriptKind.JS;
case ts.Extension.Cts:
case ts.Extension.Mts:
case ts.Extension.Ts:
return ts.ScriptKind.TS;
case ts.Extension.Json:
return ts.ScriptKind.JSON;
case ts.Extension.Jsx:
return ts.ScriptKind.JSX;
case ts.Extension.Tsx:
return ts.ScriptKind.TSX;
default:
// unknown extension, force typescript to ignore the file extension, and respect the user's setting
return jsx ? ts.ScriptKind.TSX : ts.ScriptKind.TS;
}
};
exports.getLanguageVariant = function (scriptKind) {
// https://github.com/microsoft/TypeScript/blob/d6e483b8dabd8fd37c00954c3f2184bb7f1eb90c/src/compiler/utilities.ts#L6281-L6285
switch (scriptKind) {
case ts.ScriptKind.JS:
case ts.ScriptKind.JSON:
case ts.ScriptKind.JSX:
case ts.ScriptKind.TSX:
return ts.LanguageVariant.JSX;
default:
return ts.LanguageVariant.Standard;
}
};
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const getWatchProgramsForProjects = () => {};
exports.getWatchProgramsForProjects = () => {};
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const ensureAbsolutePath = (path) => path;
exports.ensureAbsolutePath = (path) => path;
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const useProvidedPrograms = () => {};
export const createProgramFromConfigFile = () => {};
exports.useProvidedPrograms = () => {};
exports.createProgramFromConfigFile = () => {};
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const xhtmlEntities = {};
exports.xhtmlEntities = {};
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const DEFAULT_TSCONFIG_CACHE_DURATION_SECONDS = undefined;
export const ExpiringCache = class {};
exports.DEFAULT_TSCONFIG_CACHE_DURATION_SECONDS = undefined;
exports.ExpiringCache = class {};
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
export const createParseSettings = (code, options) => {
exports.createParseSettings = (code, options) => {
return {
...options,
filePath: "/test.js",
code: code,
codeFullText: code,
};
};
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const resolveProjectList = () => [];
exports.resolveProjectList = () => [];
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const inferSingleRun = () => false;
exports.inferSingleRun = () => false;
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const resolveProjectList = () => [];
exports.resolveProjectList = () => [];
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const warnAboutTSVersion = () => {};
exports.warnAboutTSVersion = () => {};
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const getFirstSemanticOrSyntacticError = () => {};
exports.getFirstSemanticOrSyntacticError = () => {};
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const simpleTraverse = () => {};
exports.simpleTraverse = () => {};
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const useProgramFromProjectService = () => {};
exports.useProgramFromProjectService = () => {};
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const typescriptVersionIsAtLeast = new Proxy({}, { get: () => true });
exports.typescriptVersionIsAtLeast = new Proxy({}, { get: () => true });
2 changes: 1 addition & 1 deletion src-playground/mocks/cosmiconfig/dist/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const cosmiconfigSync = () => {
exports.cosmiconfigSync = () => {
return { search: () => null };
};
2 changes: 1 addition & 1 deletion src-playground/mocks/flow-parser/flow_parser.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export default function () {}
module.exports = function () {};
Loading

0 comments on commit 287c04b

Please sign in to comment.