bump more versions
This commit is contained in:
parent
d67d80eb41
commit
eef651f0d4
15 changed files with 3831 additions and 4135 deletions
58
.eslintrc.js
58
.eslintrc.js
|
|
@ -1,58 +0,0 @@
|
|||
module.exports = {
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
ecmaVersion: 2018,
|
||||
sourceType: 'module',
|
||||
},
|
||||
env: {
|
||||
browser: true,
|
||||
es6: true,
|
||||
node: true,
|
||||
},
|
||||
globals: {
|
||||
Atomics: 'readonly',
|
||||
SharedArrayBuffer: 'readonly',
|
||||
document: 'readonly',
|
||||
navigator: 'readonly',
|
||||
window: 'readonly',
|
||||
},
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/eslint-recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:json/recommended',
|
||||
'plugin:promise/recommended',
|
||||
'plugin:import/errors',
|
||||
'plugin:import/warnings',
|
||||
'plugin:import/typescript',
|
||||
'plugin:node/recommended',
|
||||
'plugin:sonarjs/recommended',
|
||||
'plugin:jest/recommended',
|
||||
'plugin:jest/style',
|
||||
'prettier',
|
||||
],
|
||||
plugins: ['@typescript-eslint', 'json', 'promise', 'import', 'node', 'sonarjs', 'jest', 'optimize-regex'],
|
||||
rules: {
|
||||
// Enable
|
||||
'optimize-regex/optimize-regex': 'error',
|
||||
// Hack: For some reason we need pass again the extensions
|
||||
'node/no-missing-import': [
|
||||
'error',
|
||||
{
|
||||
tryExtensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
|
||||
},
|
||||
],
|
||||
// Disable
|
||||
// https://github.com/benmosher/eslint-plugin-import/issues/1446
|
||||
'import/named': 'off',
|
||||
// We don't need this since we are using transpilation
|
||||
'node/no-unsupported-features/es-syntax': 'off',
|
||||
'no-process-exit': 'off',
|
||||
// Too verbose
|
||||
'sonarjs/no-duplicate-string': 'off',
|
||||
// Too verbose
|
||||
'sonarjs/cognitive-complexity': 'off',
|
||||
// Too verbose
|
||||
'sonarjs/no-nested-template-literals': 'off',
|
||||
},
|
||||
};
|
||||
77
eslint.config.mjs
Normal file
77
eslint.config.mjs
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
import globals from 'globals';
|
||||
import eslint from '@eslint/js';
|
||||
import tseslint from 'typescript-eslint';
|
||||
import pluginJest from 'eslint-plugin-jest';
|
||||
import json from '@eslint/json';
|
||||
import pluginPromise from 'eslint-plugin-promise';
|
||||
|
||||
export default [
|
||||
{ ...eslint.configs.recommended, files: ['src/**/*.{js,mjs,cjs,ts}'] },
|
||||
...tseslint.configs.recommended,
|
||||
// ...tseslint.configs.recommendedTypeChecked,
|
||||
// ...tseslint.configs.strict,
|
||||
// ...tseslint.configs.stylistic,
|
||||
// ...tseslint.configs.strictTypeChecked,
|
||||
// ...tseslint.configs.stylisticTypeChecked,
|
||||
{
|
||||
rules: {
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
{
|
||||
args: 'all',
|
||||
argsIgnorePattern: '^_',
|
||||
caughtErrors: 'all',
|
||||
caughtErrorsIgnorePattern: '^_',
|
||||
destructuredArrayIgnorePattern: '^_',
|
||||
varsIgnorePattern: '^_',
|
||||
ignoreRestSiblings: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
pluginPromise.configs['flat/recommended'],
|
||||
{
|
||||
plugins: {
|
||||
json,
|
||||
},
|
||||
files: ['**/*.json'],
|
||||
language: 'json/json',
|
||||
rules: {
|
||||
'json/no-duplicate-keys': 'error',
|
||||
},
|
||||
},
|
||||
{
|
||||
...pluginJest.configs['flat/recommended'],
|
||||
...pluginJest.configs['flat/style'],
|
||||
files: ['src/__tests__/**/*tests.ts'],
|
||||
plugins: { jest: pluginJest },
|
||||
languageOptions: {
|
||||
globals: pluginJest.environments.globals.globals,
|
||||
},
|
||||
},
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
...globals.node,
|
||||
...globals.es2025,
|
||||
Atomics: 'readonly',
|
||||
SharedArrayBuffer: 'readonly',
|
||||
document: 'readonly',
|
||||
navigator: 'readonly',
|
||||
window: 'readonly',
|
||||
},
|
||||
parserOptions: {
|
||||
project: './tsconfig.eslint.json',
|
||||
tsconfigRootDir: './',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
ignores: ['src/diff2html-templates.*', 'coverage/', 'docs/', 'bundles-out/', 'bundles/', 'lib/', 'lib-esm/'],
|
||||
},
|
||||
{
|
||||
...tseslint.configs.disableTypeChecked,
|
||||
files: ['**/*.{js,mjs,cjs}'],
|
||||
},
|
||||
];
|
||||
7729
package-lock.json
generated
7729
package-lock.json
generated
File diff suppressed because it is too large
Load diff
61
package.json
61
package.json
|
|
@ -35,7 +35,6 @@
|
|||
"node": ">=12"
|
||||
},
|
||||
"scripts": {
|
||||
"eslint": "eslint --ignore-path .gitignore \"**/*.{js,jsx,ts,tsx,json}\"",
|
||||
"lint:staged": "lint-staged",
|
||||
"lint:check": "eslint",
|
||||
"lint:fix": "eslint --fix",
|
||||
|
|
@ -64,7 +63,7 @@
|
|||
"start:website": "webpack serve --mode development --config webpack.website.ts",
|
||||
"preversion": "npm run validate",
|
||||
"version": "git add -A package.json",
|
||||
"prepare": "husky install"
|
||||
"prepare": "husky"
|
||||
},
|
||||
"main": "./lib/diff2html.js",
|
||||
"module": "./lib-esm/diff2html.js",
|
||||
|
|
@ -82,63 +81,59 @@
|
|||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"diff": "^5.2.0",
|
||||
"diff": "^7.0.0",
|
||||
"hogan.js": "3.0.2"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"highlight.js": "11.9.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/diff": "^5.2.1",
|
||||
"@eslint/js": "^9.17.0",
|
||||
"@eslint/json": "^0.9.0",
|
||||
"@types/diff": "^6.0.0",
|
||||
"@types/hogan.js": "3.0.5",
|
||||
"@types/jest": "^29.5.12",
|
||||
"@types/node": "^20.14.11",
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/node": "^22.10.2",
|
||||
"@types/nopt": "3.0.32",
|
||||
"@typescript-eslint/eslint-plugin": "6.18.1",
|
||||
"@typescript-eslint/parser": "6.18.1",
|
||||
"all-contributors-cli": "^6.24.0",
|
||||
"autoprefixer": "^10.4.19",
|
||||
"bulma": "^1.0.1",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"bulma": "^1.0.2",
|
||||
"clipboard": "2.0.11",
|
||||
"copy-webpack-plugin": "^12.0.2",
|
||||
"css-loader": "^7.1.2",
|
||||
"cssnano": "^7.0.4",
|
||||
"eslint": "8.56.0",
|
||||
"eslint-config-prettier": "9.1.0",
|
||||
"eslint-plugin-import": "2.29.1",
|
||||
"eslint-plugin-jest": "27.6.3",
|
||||
"eslint-plugin-json": "3.1.0",
|
||||
"eslint-plugin-node": "11.1.0",
|
||||
"eslint-plugin-optimize-regex": "1.2.1",
|
||||
"eslint-plugin-promise": "^6.5.1",
|
||||
"eslint-plugin-sonarjs": "0.23.0",
|
||||
"cssnano": "^7.0.6",
|
||||
"eslint": "^9.17.0",
|
||||
"eslint-plugin-jest": "28.10.0",
|
||||
"eslint-plugin-promise": "^7.2.1",
|
||||
"file-loader": "6.2.0",
|
||||
"globals": "^15.14.0",
|
||||
"handlebars": "4.7.8",
|
||||
"handlebars-loader": "1.7.3",
|
||||
"html-webpack-plugin": "5.6.0",
|
||||
"husky": "^9.1.1",
|
||||
"html-webpack-plugin": "^5.6.3",
|
||||
"husky": "^9.1.7",
|
||||
"image-webpack-loader": "8.1.0",
|
||||
"is-ci-cli": "2.2.0",
|
||||
"jest": "29.7.0",
|
||||
"lint-staged": "^15.2.7",
|
||||
"lint-staged": "^15.2.11",
|
||||
"markdown-toc": "^1.2.0",
|
||||
"mini-css-extract-plugin": "^2.9.0",
|
||||
"mini-css-extract-plugin": "^2.9.2",
|
||||
"mkdirp": "3.0.1",
|
||||
"nopt": "^7.2.1",
|
||||
"postcss": "^8.4.39",
|
||||
"nopt": "^8.0.0",
|
||||
"postcss": "^8.4.49",
|
||||
"postcss-cli": "11.0.0",
|
||||
"postcss-import": "^16.1.0",
|
||||
"postcss-loader": "^8.1.1",
|
||||
"postcss-preset-env": "^9.6.0",
|
||||
"prettier": "^3.3.3",
|
||||
"ts-jest": "^29.2.3",
|
||||
"postcss-preset-env": "^10.1.2",
|
||||
"prettier": "^3.4.2",
|
||||
"ts-jest": "^29.2.5",
|
||||
"ts-loader": "9.5.1",
|
||||
"ts-node": "10.9.2",
|
||||
"typescript": "^5.5.3",
|
||||
"typescript": "^5.7.2",
|
||||
"typescript-eslint": "^8.18.2",
|
||||
"url-loader": "4.1.1",
|
||||
"webpack": "^5.93.0",
|
||||
"webpack-cli": "5.1.4",
|
||||
"webpack-dev-server": "^5.0.4",
|
||||
"webpack": "^5.97.1",
|
||||
"webpack-cli": "^6.0.1",
|
||||
"webpack-dev-server": "^5.2.0",
|
||||
"whatwg-fetch": "3.6.20"
|
||||
},
|
||||
"resolutions": {
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ function extractFiles(files: string[]): string[] {
|
|||
`;
|
||||
|
||||
if (options.version) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
console.log(require('../package.json').version);
|
||||
process.exit(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import { parse } from '../diff-parser';
|
|||
|
||||
describe('DiffParser', () => {
|
||||
describe('generateDiffJson', () => {
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
it('should parse unix with \n diff', () => {
|
||||
const diff =
|
||||
'diff --git a/sample b/sample\n' +
|
||||
|
|
@ -52,7 +51,6 @@ describe('DiffParser', () => {
|
|||
`);
|
||||
});
|
||||
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
it('should parse windows with \r\n diff', () => {
|
||||
const diff =
|
||||
'diff --git a/sample b/sample\r\n' +
|
||||
|
|
@ -102,7 +100,6 @@ describe('DiffParser', () => {
|
|||
`);
|
||||
});
|
||||
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
it('should parse old os x with \r diff', () => {
|
||||
const diff =
|
||||
'diff --git a/sample b/sample\r' +
|
||||
|
|
@ -152,7 +149,6 @@ describe('DiffParser', () => {
|
|||
`);
|
||||
});
|
||||
|
||||
// eslint-disable-next-line jest/expect-expect
|
||||
it('should parse mixed eols diff', () => {
|
||||
const diff =
|
||||
'diff --git a/sample b/sample\n' +
|
||||
|
|
|
|||
|
|
@ -458,18 +458,16 @@ export function parse(diffInput: string, config: DiffParserConfig = {}): DiffFil
|
|||
} else if ((values = index.exec(line))) {
|
||||
currentFile.checksumBefore = values[1];
|
||||
currentFile.checksumAfter = values[2];
|
||||
values[3] && (currentFile.mode = values[3]);
|
||||
if (values[3]) currentFile.mode = values[3];
|
||||
} else if ((values = combinedIndex.exec(line))) {
|
||||
currentFile.checksumBefore = [values[2], values[3]];
|
||||
currentFile.checksumAfter = values[1];
|
||||
} else if ((values = combinedMode.exec(line))) {
|
||||
currentFile.oldMode = [values[2], values[3]];
|
||||
currentFile.newMode = values[1];
|
||||
// eslint-disable-next-line sonarjs/no-duplicated-branches
|
||||
} else if ((values = combinedNewFile.exec(line))) {
|
||||
currentFile.newFileMode = values[1];
|
||||
currentFile.isNew = true;
|
||||
// eslint-disable-next-line sonarjs/no-duplicated-branches
|
||||
} else if ((values = combinedDeletedFile.exec(line))) {
|
||||
currentFile.deletedFileMode = values[1];
|
||||
currentFile.isDeleted = true;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ export default class HoganJsUtils {
|
|||
try {
|
||||
const template = this.preCompiledTemplates[templateKey];
|
||||
return template.render(params, partials, indent);
|
||||
} catch (e) {
|
||||
} catch (_e) {
|
||||
throw new Error(`Could not find template to render '${templateKey}'`);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,8 +153,7 @@ export class Diff2HtmlUI {
|
|||
|
||||
let hljsLanguage =
|
||||
language && this.config.highlightLanguages.has(language)
|
||||
? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
this.config.highlightLanguages.get(language)!
|
||||
? this.config.highlightLanguages.get(language)!
|
||||
: language
|
||||
? getLanguage(language)
|
||||
: 'plaintext';
|
||||
|
|
|
|||
5
tsconfig.eslint.json
Normal file
5
tsconfig.eslint.json
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"exclude": ["node_modules"],
|
||||
"include": ["./**/*"]
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"include": ["*env.d.ts", "src/**/*", "./typings/**/*"],
|
||||
"include": ["src/**/*", "typings/**/*"],
|
||||
"exclude": ["node_modules", "src/__tests__/**"],
|
||||
"compilerOptions": {
|
||||
"outDir": "bundles-out",
|
||||
|
|
|
|||
1
typings/merge.d.ts
vendored
1
typings/merge.d.ts
vendored
|
|
@ -1,4 +1,3 @@
|
|||
declare module 'merge' {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export function recursive(clone: boolean, ...items: object[]): object;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import path from 'path';
|
|||
import webpack from 'webpack';
|
||||
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
||||
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
||||
// eslint-disable-next-line import/default
|
||||
import CopyPlugin from 'copy-webpack-plugin';
|
||||
|
||||
const pages = ['index', 'demo'];
|
||||
|
|
|
|||
|
|
@ -123,7 +123,6 @@ function prepareRequest(url: string): Request {
|
|||
|
||||
function getConfiguration(urlParams: URLParams): Diff2HtmlUIConfig {
|
||||
// Removing `diff` and `diffTooBigMessage` form `urlParams` to avoid being inserted
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const { diff, diffTooBigMessage, ...urlParamsRest } = urlParams;
|
||||
|
||||
const defaultColorScheme: ColorSchemeType =
|
||||
|
|
@ -252,6 +251,7 @@ function getHTMLElementById(id: string): HTMLElement {
|
|||
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
// Improves browser compatibility
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
require('whatwg-fetch');
|
||||
|
||||
const drawAndUpdateUrl = async (
|
||||
|
|
@ -289,13 +289,13 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||
let [config, diffString] = await prepareInitialState(elements);
|
||||
|
||||
// Update HTML inputs from any changes in URL
|
||||
config.outputFormat && (elements.options.outputFormat.value = config.outputFormat);
|
||||
config.colorScheme && (elements.options.colorScheme.value = config.colorScheme);
|
||||
config.drawFileList && (elements.checkboxes.drawFileList.checked = config.drawFileList);
|
||||
config.matching && (elements.options.matching.value = config.matching);
|
||||
config.matchWordsThreshold && (elements.options.wordsThreshold.value = config.matchWordsThreshold.toString());
|
||||
config.matchingMaxComparisons &&
|
||||
(elements.options.matchingMaxComparisons.value = config.matchingMaxComparisons.toString());
|
||||
if (config.outputFormat) elements.options.outputFormat.value = config.outputFormat;
|
||||
if (config.colorScheme) elements.options.colorScheme.value = config.colorScheme;
|
||||
if (config.drawFileList) elements.checkboxes.drawFileList.checked = config.drawFileList;
|
||||
if (config.matching) elements.options.matching.value = config.matching;
|
||||
if (config.matchWordsThreshold) elements.options.wordsThreshold.value = config.matchWordsThreshold.toString();
|
||||
if (config.matchingMaxComparisons)
|
||||
elements.options.matchingMaxComparisons.value = config.matchingMaxComparisons.toString();
|
||||
|
||||
Object.entries(elements.options).forEach(([option, element]) =>
|
||||
element.addEventListener('change', () => {
|
||||
|
|
|
|||
|
|
@ -4,5 +4,4 @@ import '../../../main.ts';
|
|||
import '../../../main.css';
|
||||
import './index.css';
|
||||
|
||||
// eslint-disable-next-line no-new
|
||||
new Clipboard(document.getElementsByClassName('clipboard')[0]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue