Skip to content

Commit

Permalink
separated some Dom funcitons
Browse files Browse the repository at this point in the history
  • Loading branch information
e11sy committed Aug 13, 2024
1 parent ed82ec7 commit 5779e54
Show file tree
Hide file tree
Showing 27 changed files with 544 additions and 705 deletions.
10 changes: 8 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
/** eslint-disable-next-line n/no-unpublished-import */
import CodeX from 'eslint-config-codex';
import { plugin as TsPlugin, parser as TsParser } from 'typescript-eslint';
/**
* @todo connect architecture config
*/
export default [
...CodeX,
{
name: 'ts-notex.web',
name: 'ts-editorls/utils',
ignores: ['eslint.config.mjs'],
/**
* This are the options for typescript files
*/
languageOptions: {
parser: TsParser,
parserOptions: {
project: './tsconfig.eslint.json',
tsconfigRootDir: './',
sourceType: 'module', // Allows for the use of imports
},
},
plugins: {
'@typescript-eslint': TsPlugin,
},

rules: {
'n/no-missing-import': ['off'],
Expand All @@ -30,7 +36,7 @@ export default [
}],
'@typescript-eslint/naming-convention': ['error', {
selector: 'property',
format: ['UPPER_CASE' | 'camelCase'],
format: ['UPPER_CASE', 'camelCase', 'PascalCase'],
}],
},
},
Expand Down
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "utils",
"name": "@editorjs/utils",
"private": true,
"workspaces": [
"packages/*"
],
"version": "1.0.0",
"description": "Utils that are used by Editor.js and it's tools",
"main": "build/index.js",
"description": "Useful utils for working with Editor.js",
"main": "dist/index.js",
"repository": "https://github.com/editor-js/utils",
"author": "CodeX Team <all@codex.so>",
"license": "MIT",
"scripts": {
"build": "yarn build:helpers && yarn build:dom && yarn build:caret && yarn build:keyboard",
"build": "tsc && yarn build:helpers && yarn build:dom && yarn build:caret && yarn build:keyboard",
"build:helpers": "cd packages/helpers && yarn build",
"build:dom": "cd packages/dom && yarn build",
"build:caret": "cd packages/caret && yarn build",
Expand All @@ -20,11 +20,9 @@
"lint:fix": "yarn lint --fix"
},
"devDependencies": {
"tslint": "^6.1.1",
"@types/node": "^20.10.7",
"@eslint/eslintrc": "^3.1.0",
"typescript-eslint": "^7.9.0",
"eslint": "^9.0.0",
"typescript-eslint": "^7.9.0",
"eslint-config-codex": "^2.0.0",
"typescript": "^5.4.5"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/caret/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"composite": true,
"declaration": true
},
"include": ["src"],
"include": ["**/*"],
"exclude": ["dist"],
"references": [
{ "path": "../dom" }
Expand Down
17 changes: 17 additions & 0 deletions packages/dom/src/append.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Append one or several elements to the parent
* @param parent - where to append
* @param elements - element or elements list
*/
export function append(
parent: Element | DocumentFragment,
elements: Element | Element[] | DocumentFragment | Text | Text[]
): void {
if (Array.isArray(elements)) {
elements.forEach((el) => {
parent.appendChild(el);
});
} else {
parent.appendChild(elements);
}
}
Loading

0 comments on commit 5779e54

Please sign in to comment.