Skip to content

Commit 3272efc

Browse files
authored
chore(linting): eslint updated, code linted (codex-team#2174)
* update eslint + autofix * a bunch of eslint fixes * some spelling & eslint fixes * fix some eslint errors and spells * Update __module.ts * a bunch of eslint fixes in tests * Update cypress.yml * Update cypress.yml * fix cypress docker image name * fixes for tests * more tests fixed * rm rule ignore * rm another ignored rule * Update .eslintrc
1 parent 19f3790 commit 3272efc

73 files changed

Lines changed: 1170 additions & 905 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,7 @@
11
{
22
"extends": [
3-
"codex"
3+
"codex/ts"
44
],
5-
"rules": {
6-
/**
7-
* Temporary suppress some errors. We need to fix them partially in next patches
8-
*/
9-
"import/no-duplicates": ["warn"],
10-
"@typescript-eslint/triple-slash-reference": ["off"],
11-
"jsdoc/no-undefined-types": ["warn", {"definedTypes": [
12-
"ConstructorOptions",
13-
"API",
14-
"BlockToolConstructable",
15-
"EditorConfig",
16-
"Tool",
17-
"ToolSettings"
18-
]}]
19-
},
20-
"settings": {
21-
"jsdoc": {
22-
"mode": "typescript"
23-
}
24-
},
255
"globals": {
266
"Node": true,
277
"Range": true,

.github/workflows/cypress.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
firefox:
55
runs-on: ubuntu-latest
66
container:
7-
image: cypress/browsers:node14.16.0-chrome89-ff86
7+
image: cypress/browsers:node14.17.0-chrome88-ff89
88
options: --user 1001
99
steps:
1010
- uses: actions/checkout@v2

.vscode/settings.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"cSpell.words": [
3+
"Behaviour",
4+
"cacheable",
5+
"codexteam",
6+
"colspan",
7+
"contenteditable",
8+
"cssnano",
9+
"Debouncer",
10+
"devserver",
11+
"editorjs",
12+
"entrypoints",
13+
"Flippable",
14+
"hsablonniere",
15+
"intellij",
16+
"keydowns",
17+
"Kilian",
18+
"mergeable",
19+
"movetostart",
20+
"nofollow",
21+
"opencollective",
22+
"preconfigured",
23+
"rowspan",
24+
"selectall",
25+
"sometool",
26+
"stylelint",
27+
"twitterwidget"
28+
]
29+
}

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@
6767
"cssnano": "^4.1.10",
6868
"cypress": "^6.8.0",
6969
"cypress-intellij-reporter": "^0.0.6",
70-
"eslint": "^6.8.0",
71-
"eslint-config-codex": "^1.3.3",
70+
"eslint": "^8.28.0",
71+
"eslint-config-codex": "^1.7.1",
7272
"eslint-loader": "^4.0.2",
73-
"eslint-plugin-chai-friendly": "^0.6.0",
74-
"eslint-plugin-cypress": "^2.11.2",
73+
"eslint-plugin-chai-friendly": "^0.7.2",
74+
"eslint-plugin-cypress": "^2.12.1",
7575
"extract-text-webpack-plugin": "^3.0.2",
7676
"html-janitor": "^2.0.4",
7777
"license-webpack-plugin": "^2.1.4",

src/codex.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ declare const VERSION: string;
1919
* Short Description (눈_눈;)
2020
*
2121
* @version 2.18.0
22-
*
2322
* @license Apache-2.0
2423
* @author CodeX-Team <https://ifmo.su>
2524
*/

src/components/__module.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@ export type ModuleNodes = object;
1414
* @abstract
1515
* @class Module
1616
* @classdesc All modules inherits from this class.
17-
*
1817
* @typedef {Module} Module
1918
* @property {object} config - Editor user settings
2019
* @property {EditorModules} Editor - List of Editor modules
2120
*/
22-
export default class Module<T extends ModuleNodes = {}> {
21+
export default class Module<T extends ModuleNodes = Record<string, HTMLElement>> {
2322
/**
2423
* Each module can provide some UI elements that will be stored in this property
2524
*/
@@ -92,8 +91,9 @@ export default class Module<T extends ModuleNodes = {}> {
9291

9392
/**
9493
* @class
95-
*
96-
* @param {ModuleConfig} - Module config
94+
* @param options - Module options
95+
* @param options.config - Module config
96+
* @param options.eventsDispatcher - Common event bus
9797
*/
9898
constructor({ config, eventsDispatcher }: ModuleConfig) {
9999
if (new.target === Module) {

src/components/block-tunes/block-tune-delete.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/**
22
* @class DeleteTune
33
* @classdesc Editor's default tune that moves up selected block
4-
*
54
* @copyright <CodeX Team> 2018
65
*/
76
import { API, BlockTune, PopoverItem } from '../../../types';
@@ -37,22 +36,21 @@ export default class DeleteTune implements BlockTune {
3736
*/
3837
public render(): PopoverItem {
3938
return {
39+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
4040
icon: $.svg('cross', 14, 14).outerHTML,
4141
label: this.api.i18n.t('Delete'),
4242
name: 'delete',
4343
confirmation: {
4444
label: this.api.i18n.t('Click to delete'),
45-
onActivate: (item, e): void => this.handleClick(e),
45+
onActivate: (): void => this.handleClick(),
4646
},
4747
};
4848
}
4949

5050
/**
5151
* Delete block conditions passed
52-
*
53-
* @param {MouseEvent} event - click event
5452
*/
55-
public handleClick(event: MouseEvent): void {
53+
public handleClick(): void {
5654
this.api.blocks.delete();
5755
}
5856
}

src/components/block-tunes/block-tune-move-down.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/**
22
* @class MoveDownTune
33
* @classdesc Editor's default tune - Moves down highlighted block
4-
*
54
* @copyright <CodeX Team> 2018
65
*/
76

@@ -46,6 +45,7 @@ export default class MoveDownTune implements BlockTune {
4645
*/
4746
public render(): PopoverItem {
4847
return {
48+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
4949
icon: $.svg('arrow-down', 14, 14).outerHTML,
5050
label: this.api.i18n.t('Move down'),
5151
onActivate: (item, event): void => this.handleClick(event),
@@ -72,6 +72,7 @@ export default class MoveDownTune implements BlockTune {
7272

7373
window.setTimeout(() => {
7474
button.classList.remove(this.CSS.animation);
75+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
7576
}, 500);
7677

7778
return;

src/components/block-tunes/block-tune-move-up.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/**
22
* @class MoveUpTune
33
* @classdesc Editor's default tune that moves up selected block
4-
*
54
* @copyright <CodeX Team> 2018
65
*/
76
import $ from '../dom';
8-
import { API, BlockTune, BlockAPI, PopoverItem } from '../../../types';
7+
import { API, BlockTune, PopoverItem } from '../../../types';
98
import Popover from '../../components/utils/popover';
109

1110
/**
@@ -45,6 +44,7 @@ export default class MoveUpTune implements BlockTune {
4544
*/
4645
public render(): PopoverItem {
4746
return {
47+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
4848
icon: $.svg('arrow-up', 14, 14).outerHTML,
4949
label: this.api.i18n.t('Move up'),
5050
onActivate: (item, e): void => this.handleClick(e),
@@ -71,6 +71,7 @@ export default class MoveUpTune implements BlockTune {
7171

7272
window.setTimeout(() => {
7373
button.classList.remove(this.CSS.animation);
74+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
7475
}, 500);
7576

7677
return;

src/components/block/api.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { BlockAPI as BlockAPIInterface } from '../../../types/api';
77
* Constructs new BlockAPI object
88
*
99
* @class
10-
*
1110
* @param {Block} block - Block to expose
1211
*/
1312
function BlockAPI(
@@ -90,7 +89,6 @@ function BlockAPI(
9089
*
9190
* @param {string} methodName - method to call
9291
* @param {object} param - object with parameters
93-
*
9492
* @returns {unknown}
9593
*/
9694
call(methodName: string, param?: object): unknown {
@@ -110,7 +108,6 @@ function BlockAPI(
110108
* Validate Block data
111109
*
112110
* @param {BlockToolData} data - data to validate
113-
*
114111
* @returns {Promise<boolean>}
115112
*/
116113
validate(data: BlockToolData): Promise<boolean> {

0 commit comments

Comments
 (0)