Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jens-meisner committed Nov 15, 2024
1 parent 10dc5fa commit f27d322
Show file tree
Hide file tree
Showing 31 changed files with 238 additions and 232 deletions.
66 changes: 33 additions & 33 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,30 @@ module.exports = {
// Ignore compiled JavaScript files, as they are generated automatically.
"**/src/**/*.js",
// Also, do not check typing declarations, too.
"**/src/**/*.d.ts"
"**/src/**/*.d.ts",
],
overrides: [
{
files: ["**/*.{js,cjs,mjs,ts,tsx}"],
extends: [
// Prettier recommended for formatting rules: https://typescript-eslint.io/docs/linting/configs/#prettier
"prettier",
"plugin:prettier/recommended" // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
"plugin:prettier/recommended", // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],
rules: {
"prettier/prettier": "error"
}
"prettier/prettier": "error",
},
},
{
files: ["**/*.js"],
extends: ["eslint:recommended"]
extends: ["eslint:recommended"],
},
{
files: ["**/*.config.{js,cjs,mjs}", "**/*.local.{js,cjs,mjs}", "**/*rc.{js,cjs,mjs}"],
rules: {
"no-undef": "off",
"no-unused-vars": "off"
}
"no-unused-vars": "off",
},
},
{
files: ["**/*.{ts,tsx}"],
Expand All @@ -45,7 +45,7 @@ module.exports = {
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@typescript-eslint/strict",
"plugin:jsdoc/recommended"
"plugin:jsdoc/recommended",
],
rules: {
/*
Expand Down Expand Up @@ -126,16 +126,16 @@ module.exports = {
{ name: "setInterval" },
{ name: "clearInterval" },
{ name: "setImmediate" },
{ name: "clearImmediate" }
{ name: "clearImmediate" },
],
// https://github.com/typescript-eslint/typescript-eslint/issues/1391#issuecomment-1124154589
"no-restricted-syntax": [
"error",
{
// kind="method": Don't apply on constructors.
selector: ":matches(PropertyDefinition, MethodDefinition[kind=\"method\"])[accessibility=\"private\"]",
message: "Use #private instead"
}
selector: ':matches(PropertyDefinition, MethodDefinition[kind="method"])[accessibility="private"]',
message: "Use #private instead",
},
],
"no-sparse-arrays": "error",
"no-template-curly-in-string": "error",
Expand Down Expand Up @@ -171,8 +171,8 @@ module.exports = {
"jsdoc/check-tag-names": [
"error",
{
definedTags: ["category", "packageDocumentation", "typeParam"]
}
definedTags: ["category", "packageDocumentation", "typeParam"],
},
],
// allowWhitespace: Must be true not to collide with Markdown.
"jsdoc/no-multi-asterisks": ["error", { allowWhitespace: true }],
Expand Down Expand Up @@ -217,51 +217,51 @@ module.exports = {
{
selector: "typeLike",
format: ["PascalCase"],
filter: { regex: "^(__String|[A-Za-z]+_[A-Za-z]+)$", match: false }
filter: { regex: "^(__String|[A-Za-z]+_[A-Za-z]+)$", match: false },
},
{
selector: "interface",
format: ["PascalCase"],
custom: { regex: "^I[A-Z]", match: false },
filter: { regex: "^I(Arguments|TextWriter|O([A-Z][a-z]+[A-Za-z]*)?)$", match: false }
filter: { regex: "^I(Arguments|TextWriter|O([A-Z][a-z]+[A-Za-z]*)?)$", match: false },
},
{
selector: "variable",
format: ["camelCase", "PascalCase", "UPPER_CASE"],
leadingUnderscore: "allow",
filter: { regex: "^(_{1,2}filename|_{1,2}dirname|_+|[A-Za-z]+_[A-Za-z]+)$", match: false }
filter: { regex: "^(_{1,2}filename|_{1,2}dirname|_+|[A-Za-z]+_[A-Za-z]+)$", match: false },
},
{
selector: "function",
format: ["camelCase", "PascalCase"],
leadingUnderscore: "allow",
filter: { regex: "^[A-Za-z]+_[A-Za-z]+$", match: false }
filter: { regex: "^[A-Za-z]+_[A-Za-z]+$", match: false },
},
{
selector: "parameter",
format: ["camelCase"],
leadingUnderscore: "allow",
filter: { regex: "^(_+|[A-Za-z]+_[A-Z][a-z]+)$", match: false }
filter: { regex: "^(_+|[A-Za-z]+_[A-Z][a-z]+)$", match: false },
},
{
selector: "method",
format: ["camelCase", "PascalCase"],
leadingUnderscore: "allow",
filter: { regex: "^([0-9]+|[A-Za-z]+_[A-Za-z]+)$", match: false }
filter: { regex: "^([0-9]+|[A-Za-z]+_[A-Za-z]+)$", match: false },
},
{
selector: "memberLike",
format: ["camelCase"],
leadingUnderscore: "allow",
filter: { regex: "^([0-9]+|[A-Za-z]+_[A-Za-z]+)$", match: false }
filter: { regex: "^([0-9]+|[A-Za-z]+_[A-Za-z]+)$", match: false },
},
{
selector: "enumMember",
format: ["camelCase", "PascalCase", "UPPER_CASE"],
leadingUnderscore: "allow",
filter: { regex: "^[A-Za-z]+_[A-Za-z]+$", match: false }
filter: { regex: "^[A-Za-z]+_[A-Za-z]+$", match: false },
},
{ selector: "property", format: null }
{ selector: "property", format: null },
],

"@typescript-eslint/no-base-to-string": "error",
Expand Down Expand Up @@ -314,14 +314,14 @@ module.exports = {
{
asyncArrow: "always",
anonymous: "always",
named: "never"
}
named: "never",
},
],

"@typescript-eslint/triple-slash-reference": "error",
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unified-signatures": "error"
}
"@typescript-eslint/unified-signatures": "error",
},
},
/*
* Test-specific overrides.
Expand All @@ -338,17 +338,17 @@ module.exports = {
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"jsdoc/require-jsdoc": "off"
}
"jsdoc/require-jsdoc": "off",
},
},
/*
* Overrides for example application.
*/
{
files: ["app/**/*.{ts,tsx}"],
rules: {
"jsdoc/require-jsdoc": "off"
}
}
]
"jsdoc/require-jsdoc": "off",
},
},
],
};
4 changes: 2 additions & 2 deletions app/src/DataFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ export const dataFormatter: {
collapseContent: false,
whiteSpaceAtEndOfSelfclosingTag: true,
})
: empty ?? "",
text: (data, empty) => (data ? data : empty ?? ""),
: (empty ?? ""),
text: (data, empty) => (data ? data : (empty ?? "")),
};
28 changes: 14 additions & 14 deletions app/webpack.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,49 +22,49 @@ module.exports = {
path: path.resolve(__dirname, "dist"),
filename: "ckeditor.js",
libraryTarget: "umd",
libraryExport: "default"
libraryExport: "default",
},

optimization: {
minimizer: [
new TerserPlugin({
terserOptions: {
sourceMap: true
sourceMap: true,
},
extractComments: false
})
]
extractComments: false,
}),
],
},

plugins: [
new CKEditorTranslationsPlugin({
// UI language. Language codes follow the https://en.wikipedia.org/wiki/ISO_639-1 format.
// When changing the built-in language, remember to also change it in the editor's configuration (src/ckeditor.js).
language: "en",
additionalLanguages: ["de"]
additionalLanguages: ["de"],
}),
new webpack.BannerPlugin({
banner: bundler.getLicenseBanner(),
raw: true
raw: true,
}),
new CircularDependencyPlugin({
exclude: /node_modules/,
failOnError: true
})
failOnError: true,
}),
],

module: {
rules: [
loaders.getIconsLoader({ matchExtensionOnly: true }),
loaders.getStylesLoader({
themePath: require.resolve("@ckeditor/ckeditor5-theme-lark/dist/index.css"),
minify: true
minify: true,
}),
loaders.getTypeScriptLoader()
]
loaders.getTypeScriptLoader(),
],
},

resolve: {
extensions: [".ts", ".js", ".json"]
}
extensions: [".ts", ".js", ".json"],
},
};
74 changes: 37 additions & 37 deletions packages/ckeditor5-coremedia-content-clipboard/src/converters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,43 +32,43 @@ export interface RemoveMarkerEventData {
*/
export const addContentMarkerConversion =
(pendingMarkerNames: string[], callback: (markerData: MarkerData) => void) =>
(evt: EventInfo, data: AddMarkerEventData, conversionApi: DowncastConversionApi): void => {
if (pendingMarkerNames.includes(data.markerName)) {
evt.stop();
return;
}
pendingMarkerNames.push(data.markerName);
const viewPosition = conversionApi.mapper.toViewPosition(data.markerRange.start);
const contentInputData = ContentInputDataCache.lookupData(data.markerName);
if (!contentInputData) {
return;
}
/*
* Possible extension point. Do we want to fetch the object type here to
* render something more specific?
*
* The problem might be that we are asynchronous and that the spinner has to
* be shown before all requests are done. It might be possible to show a
* spinner until the first request is done and then render something more
* specific
*
* What would be the allowed specific thing? CSS-Class or a whole view?
* I guess we are not that flexible and a css class might be enough. We can
* simply add classes to the view container.
*/
const loadMaskClasses = ["cm-load-mask"];
if (contentInputData.itemContext.isInline) {
loadMaskClasses.push("cm-load-mask--inline");
}
const viewContainer = conversionApi.writer.createUIElement("div", {
class: loadMaskClasses.join(" ")
});
conversionApi.writer.insert(viewPosition, viewContainer);
conversionApi.mapper.bindElementToMarker(viewContainer, data.markerName);
const markerData = ContentClipboardMarkerDataUtils.splitMarkerName(data.markerName);
callback(markerData);
(evt: EventInfo, data: AddMarkerEventData, conversionApi: DowncastConversionApi): void => {
if (pendingMarkerNames.includes(data.markerName)) {
evt.stop();
};
return;
}
pendingMarkerNames.push(data.markerName);
const viewPosition = conversionApi.mapper.toViewPosition(data.markerRange.start);
const contentInputData = ContentInputDataCache.lookupData(data.markerName);
if (!contentInputData) {
return;
}
/*
* Possible extension point. Do we want to fetch the object type here to
* render something more specific?
*
* The problem might be that we are asynchronous and that the spinner has to
* be shown before all requests are done. It might be possible to show a
* spinner until the first request is done and then render something more
* specific
*
* What would be the allowed specific thing? CSS-Class or a whole view?
* I guess we are not that flexible and a css class might be enough. We can
* simply add classes to the view container.
*/
const loadMaskClasses = ["cm-load-mask"];
if (contentInputData.itemContext.isInline) {
loadMaskClasses.push("cm-load-mask--inline");
}
const viewContainer = conversionApi.writer.createUIElement("div", {
class: loadMaskClasses.join(" "),
});
conversionApi.writer.insert(viewPosition, viewContainer);
conversionApi.mapper.bindElementToMarker(viewContainer, data.markerName);
const markerData = ContentClipboardMarkerDataUtils.splitMarkerName(data.markerName);
callback(markerData);
evt.stop();
};

/**
* Conversion function used in DowncastDispatcher event listeners.
Expand All @@ -84,7 +84,7 @@ export const addContentMarkerConversion =
export const removeContentMarkerConversion = (
evt: EventInfo,
data: RemoveMarkerEventData,
conversionApi: DowncastConversionApi
conversionApi: DowncastConversionApi,
): void => {
const elements = conversionApi.mapper.markerNameToElements(data.markerName);
if (!elements) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class PasteContentUI extends Plugin {
const t = editor.t;
const pasteContentCommand = editor.commands.get("pasteContentCommand");
if (!pasteContentCommand) {
throw new Error("The command \"pasteContent\" is required.");
throw new Error('The command "pasteContent" is required.');
}
const PASTE_KEYSTROKE = "Ctrl+Shift+P";
editor.keystrokes.set(PASTE_KEYSTROKE, (keyEvtData, cancel) => {
Expand Down
10 changes: 5 additions & 5 deletions packages/ckeditor5-coremedia-content/src/OpenInTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface OpenEntitiesInTabsResult {
*/
export const emptyOpenEntitiesInTabsResult: OpenEntitiesInTabsResult = {
accepted: [],
rejected: []
rejected: [],
};

/**
Expand All @@ -40,7 +40,7 @@ export const canAllBeOpenedInTab = async (...uriPaths: string[]): Promise<boolea
workAreaService.canBeOpenedInTab(uriPaths).catch((error): boolean => {
logger.debug(`Failed to query "canBeOpenedInTab" for ${uriPaths}. Default to false.`, error);
return false;
})
}),
);
};

Expand All @@ -65,8 +65,8 @@ export const openEntitiesInTabs = async (...uriPaths: string[]): Promise<OpenEnt
(workAreaService): Promise<OpenEntitiesInTabsResult> =>
workAreaService.openEntitiesInTabs(uriPaths, false, {
additionalOptions: {
focusTab: true
}
})
focusTab: true,
},
}),
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const registerOpenImageInTabCommand = (editor: Editor, name = openImageIn
*/
export const requireOpenImageInTabCommand = (
editor: Editor,
name: typeof openImageInTabCommandName = openImageInTabCommandName
name: typeof openImageInTabCommandName = openImageInTabCommandName,
): OpenImageInTabCommand => {
const command = editor.commands.get(name);
if (!command) {
Expand All @@ -74,5 +74,5 @@ export const requireOpenImageInTabCommand = (
export const executeOpenImageInTabCommand = (
editor: Editor,
uriPaths: UriPath[] = [],
name: typeof openImageInTabCommandName = openImageInTabCommandName
name: typeof openImageInTabCommandName = openImageInTabCommandName,
) => editor.commands.get(name)?.execute(...uriPaths);
Loading

0 comments on commit f27d322

Please sign in to comment.