Skip to content

Commit 2a00c57

Browse files
author
Juan C. Carvajal B.
committed
feat: full refator to react
1 parent 2cdc026 commit 2a00c57

30 files changed

Lines changed: 7576 additions & 2145 deletions

.babelrc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/** @type {import('@babel/core').TransformOptions} */
2+
const config = {
3+
presets: [
4+
['@babel/preset-env', { targets: { node: 'current' } }],
5+
['@babel/preset-react', { runtime: 'classic' }]
6+
]
7+
};
8+
9+
module.exports = config;

eslint.config.mjs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import globals from "globals";
22
import pluginJs from "@eslint/js";
3+
import pluginTs from "@typescript-eslint/eslint-plugin";
4+
import parserTs from "@typescript-eslint/parser";
35

46
export default [
57
pluginJs.configs.recommended,
68
{
9+
files: ["lib/**/*.ts", "lib/**/*.tsx", "spec/**/*.ts", "spec/**/*.tsx"],
710
languageOptions: {
811
ecmaVersion: 2020,
912
sourceType: "module",
@@ -12,11 +15,21 @@ export default [
1215
...globals.jasmine,
1316
...globals.node,
1417
atom: "readonly",
15-
etch: "readonly"
16-
}
18+
etch: "readonly",
19+
jest: "readonly"
20+
},
21+
parser: parserTs
22+
},
23+
plugins: {
24+
"@typescript-eslint": pluginTs
1725
},
18-
files: ["lib/**/*.ts", "spec/**/*.ts"],
1926
rules: {
27+
"no-unused-vars": "off",
28+
"no-undef": "off",
29+
"@typescript-eslint/no-explicit-any": "off",
30+
"@typescript-eslint/no-unused-vars": "off",
31+
"@typescript-eslint/ban-ts-comment": "off",
32+
"@typescript-eslint/no-undef": "off",
2033
"indent": ["error", 2],
2134
"linebreak-style": ["error", "unix"],
2235
"quotes": ["error", "single"],

jest.config.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/** @type {import('jest').Config} */
2+
const config = {
3+
testEnvironment: 'jsdom',
4+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
5+
transform: {
6+
'^.+\\.(ts|tsx)$': ['ts-jest', { useESM: false }]
7+
},
8+
testMatch: ['**/spec/**/*.spec.ts?(x)', '**/*.test.ts?(x)'],
9+
moduleNameMapper: {
10+
'^atom$': '<rootDir>/lib/atom.ts'
11+
},
12+
collectCoverageFrom: [
13+
'lib/**/*.ts?(x)',
14+
'!lib/**/*.d.ts'
15+
],
16+
setupFilesAfterEnv: ['<rootDir>/src/setup-tests.ts']
17+
};
18+
19+
module.exports = config;

lib/atom.d.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Minimal type declarations for atom module
2+
declare module 'atom' {
3+
export const workspace: any;
4+
export const commands: any;
5+
export const config: any;
6+
export const themes: any;
7+
export const project: any;
8+
export const clipboard: any;
9+
export const deserializers: any;
10+
export const packages: any;
11+
export function spawn(path: string, args?: string[]): any;
12+
13+
export class CompositeDisposable {
14+
constructor();
15+
add(disposable: any): void;
16+
dispose(): void;
17+
}
18+
19+
export class Emitter {
20+
constructor();
21+
emit(event: string, data?: any): void;
22+
on(event: string, callback: (data?: any) => any): { dispose(): void };
23+
dispose(): void;
24+
}
25+
}
26+
27+
declare const process: {
28+
platform: string;
29+
env: { [key: string]: string | undefined };
30+
HOME?: string;
31+
COMSPEC?: string;
32+
SHELL?: string;
33+
};

lib/atom.ts

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
// Mock atom module for testing
2+
export const workspace = {
3+
open: () => {},
4+
getActivePane: () => ({ destroyActiveItem: () => {} }),
5+
getActivePaneItem: () => null,
6+
addOpener: () => ({ dispose: () => {} }),
7+
views: {
8+
addViewProvider: () => ({ dispose: () => {} })
9+
}
10+
};
11+
12+
export const commands = {
13+
add: () => ({ dispose: () => {} })
14+
};
15+
16+
export const config = {
17+
get: () => null
18+
};
19+
20+
export const themes = {
21+
onDidChangeActiveThemes: () => ({ dispose: () => {} })
22+
};
23+
24+
export const project = {
25+
getPaths: () => [],
26+
relativizePath: () => []
27+
};
28+
29+
export const clipboard = {
30+
write: () => {},
31+
read: () => ''
32+
};
33+
34+
export const deserializers = {
35+
add: () => {}
36+
};
37+
38+
export const packages = {
39+
activatePackage: () => Promise.resolve()
40+
};
41+
42+
export const spawn = () => ({
43+
write: () => {},
44+
kill: () => {},
45+
onData: () => ({ dispose: () => {} }),
46+
onExit: () => ({ dispose: () => {} })
47+
});
48+
49+
export class CompositeDisposable {
50+
private disposables: any[] = [];
51+
52+
add(disposable: any) {
53+
this.disposables.push(disposable);
54+
}
55+
56+
dispose() {
57+
this.disposables.forEach(d => d.dispose && d.dispose());
58+
this.disposables = [];
59+
}
60+
}
61+
62+
export class Emitter {
63+
private listeners: { [key: string]: Array<(data?: any) => void> } = {};
64+
65+
emit(event: string, data?: any) {
66+
if (this.listeners[event]) {
67+
this.listeners[event].forEach(cb => cb(data));
68+
}
69+
}
70+
71+
on(event: string, callback: (data?: any) => void) {
72+
if (!this.listeners[event]) {
73+
this.listeners[event] = [];
74+
}
75+
this.listeners[event].push(callback);
76+
77+
return {
78+
dispose: () => {
79+
this.listeners[event] = this.listeners[event].filter(cb => cb !== callback);
80+
if (this.listeners[event].length === 0) {
81+
delete this.listeners[event];
82+
}
83+
}
84+
};
85+
}
86+
87+
dispose() {
88+
this.listeners = {};
89+
}
90+
}
91+
92+
export const process = {
93+
platform: 'linux',
94+
env: {}
95+
};

lib/config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/** @babel */
2-
31
export default {
42

53
defaultLocation: {

lib/main.ts

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)