Skip to content

Commit

Permalink
chore(eslint): merge with master, and refactor code with eslint confi…
Browse files Browse the repository at this point in the history
…guration
  • Loading branch information
dependentmadani committed Aug 2, 2024
2 parents 66e734b + 5d1c57c commit b4b9290
Show file tree
Hide file tree
Showing 13 changed files with 744 additions and 772 deletions.
8 changes: 0 additions & 8 deletions .eslintrc

This file was deleted.

14 changes: 8 additions & 6 deletions dev/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ class ServerExample {

this.getForm(request)
.then(({files}) => {
let image = files[this.fieldName] || {};
let image = files[this.fieldName][0] || {};

responseJson.success = 1;
responseJson.file = {
url: image.path,
name: image.name,
url: 'file://' + image.filepath,
name: image.newFilename,
size: image.size
};
})
Expand Down Expand Up @@ -147,10 +147,12 @@ class ServerExample {
*/
getForm(request) {
return new Promise((resolve, reject) => {
const form = new formidable.IncomingForm();
const form = new formidable.IncomingForm({
uploadDir: this.uploadDir,
keepExtensions: true
});

form.uploadDir = this.uploadDir;
form.keepExtensions = true;
console.error('the form info:', form);

form.parse(request, (err, fields, files) => {
if (err) {
Expand Down
48 changes: 48 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import Codex from "eslint-config-codex";
import { plugin as TsPlugin, parser as TsParser } from 'typescript-eslint';

export default [
...Codex,
{
files: ['src/**/*.ts'],
languageOptions: {
parser: TsParser,
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: './',
sourceType: 'module',
},
},
rules: {
'n/no-missing-import': ['off'],
'n/no-unsupported-features/node-builtins': ['off'],
'jsdoc/require-returns-description': ['off'],
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "variable",
"format": ["camelCase"],
"leadingUnderscore": "allow"
},
],
"@typescript-eslint/ban-types": ["error",
{
"types": {
"String": true,
"Boolean": true,
"Number": true,
"Symbol": true,
"{}": false,
"Object": true,
"object": false,
"Function": false,
},
"extendDefaults": true
}
]
}
},
{
ignores: ['dev/**', 'eslint.config.mjs', 'vite.config.js', 'postcss.config.js']
}
];
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@editorjs/image",
"version": "2.9.1",
"version": "2.9.3",
"keywords": [
"codex editor",
"image",
Expand All @@ -26,9 +26,9 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint src/ --ext .ts",
"lint:errors": "eslint src/ --quiet",
"lint:fix": "eslint src/ --fix"
"lint": "eslint",
"lint:errors": "eslint --quiet",
"lint:fix": "eslint --fix"
},
"author": {
"name": "CodeX",
Expand All @@ -37,16 +37,17 @@
"devDependencies": {
"@codexteam/ajax": "^4.2.0",
"@editorjs/editorjs": "2.30.0-rc.12",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"eslint": "^7.22.0",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"eslint": "^9.7.0",
"eslint-config-codex": "^2.0.1",
"eslint-loader": "^4.0.2",
"formidable": "^3.5.1",
"postcss-nested": "^6.0.1",
"postcss-nested-ancestors": "^3.0.0",
"request": "^2.88.0",
"typescript": "^5.4.5",
"typescript-eslint": "^7.17.0",
"vite": "^5.3.1",
"vite-plugin-css-injected-by-js": "^3.5.1",
"vite-plugin-dts": "^3.9.1"
Expand Down
Loading

0 comments on commit b4b9290

Please sign in to comment.