Skip to content

Commit 4718b8d

Browse files
authored
Merge pull request #26 from RoopikLabs/develop
Final Architecture: Core (Project Mode) + Extension (Canvas Component Mode)
2 parents 91a38b2 + 28657e3 commit 4718b8d

1,079 files changed

Lines changed: 92710 additions & 31114 deletions

File tree

Some content is hidden

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

.eslint-plugin-local/code-amd-node-module.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as eslint from 'eslint';
7-
import * as ESTree from 'estree';
7+
import type * as ESTree from 'estree';
8+
import { readFileSync } from 'fs';
89
import { join } from 'path';
910

1011

11-
export = new class ApiProviderNaming implements eslint.Rule.RuleModule {
12+
export default new class ApiProviderNaming implements eslint.Rule.RuleModule {
1213

1314
readonly meta: eslint.Rule.RuleMetaData = {
1415
messages: {
@@ -22,7 +23,8 @@ export = new class ApiProviderNaming implements eslint.Rule.RuleModule {
2223
const modules = new Set<string>();
2324

2425
try {
25-
const { dependencies, optionalDependencies } = require(join(__dirname, '../package.json'));
26+
const packageJson = JSON.parse(readFileSync(join(import.meta.dirname, '../package.json'), 'utf-8'));
27+
const { dependencies, optionalDependencies } = packageJson;
2628
const all = Object.keys(dependencies).concat(Object.keys(optionalDependencies));
2729
for (const key of all) {
2830
modules.add(key);

.eslint-plugin-local/code-declare-service-brand.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as eslint from 'eslint';
7-
import * as ESTree from 'estree';
7+
import type * as ESTree from 'estree';
88

9-
export = new class DeclareServiceBrand implements eslint.Rule.RuleModule {
9+
export default new class DeclareServiceBrand implements eslint.Rule.RuleModule {
1010

1111
readonly meta: eslint.Rule.RuleMetaData = {
1212
fixable: 'code',

.eslint-plugin-local/code-ensure-no-disposables-leak-in-test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as eslint from 'eslint';
7-
import { Node } from 'estree';
7+
import type * as estree from 'estree';
88

9-
export = new class EnsureNoDisposablesAreLeakedInTestSuite implements eslint.Rule.RuleModule {
9+
export default new class EnsureNoDisposablesAreLeakedInTestSuite implements eslint.Rule.RuleModule {
1010

1111
readonly meta: eslint.Rule.RuleMetaData = {
1212
type: 'problem',
@@ -18,15 +18,15 @@ export = new class EnsureNoDisposablesAreLeakedInTestSuite implements eslint.Rul
1818
};
1919

2020
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
21-
const config = <{ exclude: string[] }>context.options[0];
21+
const config = context.options[0] as { exclude: string[] };
2222

2323
const needle = context.getFilename().replace(/\\/g, '/');
2424
if (config.exclude.some((e) => needle.endsWith(e))) {
2525
return {};
2626
}
2727

2828
return {
29-
[`Program > ExpressionStatement > CallExpression[callee.name='suite']`]: (node: Node) => {
29+
[`Program > ExpressionStatement > CallExpression[callee.name='suite']`]: (node: estree.Node) => {
3030
const src = context.getSourceCode().getText(node);
3131
if (!src.includes('ensureNoDisposablesAreLeakedInTestSuite(')) {
3232
context.report({

.eslint-plugin-local/code-import-patterns.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import * as eslint from 'eslint';
77
import { TSESTree } from '@typescript-eslint/utils';
88
import * as path from 'path';
99
import minimatch from 'minimatch';
10-
import { createImportRuleListener } from './utils';
10+
import { createImportRuleListener } from './utils.ts';
1111

12-
const REPO_ROOT = path.normalize(path.join(__dirname, '../'));
12+
const REPO_ROOT = path.normalize(path.join(import.meta.dirname, '../'));
1313

1414
interface ConditionalPattern {
1515
when?: 'hasBrowser' | 'hasNode' | 'hasElectron' | 'test';
@@ -31,15 +31,15 @@ interface LayerAllowRule {
3131
type RawOption = RawImportPatternsConfig | LayerAllowRule;
3232

3333
function isLayerAllowRule(option: RawOption): option is LayerAllowRule {
34-
return !!((<LayerAllowRule>option).when && (<LayerAllowRule>option).allow);
34+
return !!((option as LayerAllowRule).when && (option as LayerAllowRule).allow);
3535
}
3636

3737
interface ImportPatternsConfig {
3838
target: string;
3939
restrictions: string[];
4040
}
4141

42-
export = new class implements eslint.Rule.RuleModule {
42+
export default new class implements eslint.Rule.RuleModule {
4343

4444
readonly meta: eslint.Rule.RuleMetaData = {
4545
messages: {
@@ -55,7 +55,7 @@ export = new class implements eslint.Rule.RuleModule {
5555
};
5656

5757
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
58-
const options = <RawOption[]>context.options;
58+
const options = context.options as RawOption[];
5959
const configs = this._processOptions(options);
6060
const relativeFilename = getRelativeFilename(context);
6161

@@ -217,7 +217,7 @@ export = new class implements eslint.Rule.RuleModule {
217217
configs.push(testConfig);
218218
}
219219
} else {
220-
configs.push({ target, restrictions: <string[]>restrictions.filter(r => typeof r === 'string') });
220+
configs.push({ target, restrictions: restrictions.filter(r => typeof r === 'string') as string[] });
221221
}
222222
}
223223
this._optionsCache.set(options, configs);

.eslint-plugin-local/code-layering.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55

66
import * as eslint from 'eslint';
77
import { join, dirname } from 'path';
8-
import { createImportRuleListener } from './utils';
8+
import { createImportRuleListener } from './utils.ts';
99

1010
type Config = {
1111
allowed: Set<string>;
1212
disallowed: Set<string>;
1313
};
1414

15-
export = new class implements eslint.Rule.RuleModule {
15+
export default new class implements eslint.Rule.RuleModule {
1616

1717
readonly meta: eslint.Rule.RuleMetaData = {
1818
messages: {
@@ -38,8 +38,7 @@ export = new class implements eslint.Rule.RuleModule {
3838

3939
const fileDirname = dirname(context.getFilename());
4040
const parts = fileDirname.split(/\\|\//);
41-
const ruleArgs = <Record<string, string[]>>context.options[0];
42-
41+
const ruleArgs = context.options[0] as Record<string, string[]>;
4342
let config: Config | undefined;
4443
for (let i = parts.length - 1; i >= 0; i--) {
4544
if (ruleArgs[parts[i]]) {
@@ -91,4 +90,3 @@ export = new class implements eslint.Rule.RuleModule {
9190
});
9291
}
9392
};
94-

.eslint-plugin-local/code-limited-top-functions.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
import * as eslint from 'eslint';
77
import { dirname, relative } from 'path';
88
import minimatch from 'minimatch';
9-
import * as ESTree from 'estree';
9+
import type * as ESTree from 'estree';
1010

11-
export = new class implements eslint.Rule.RuleModule {
11+
export default new class implements eslint.Rule.RuleModule {
1212

1313
readonly meta: eslint.Rule.RuleMetaData = {
1414
messages: {
@@ -29,11 +29,11 @@ export = new class implements eslint.Rule.RuleModule {
2929
};
3030

3131
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
32-
let fileRelativePath = relative(dirname(__dirname), context.getFilename());
32+
let fileRelativePath = relative(dirname(import.meta.dirname), context.getFilename());
3333
if (!fileRelativePath.endsWith('/')) {
3434
fileRelativePath += '/';
3535
}
36-
const ruleArgs = <Record<string, string[]>>context.options[0];
36+
const ruleArgs = context.options[0] as Record<string, string[]>;
3737

3838
const matchingKey = Object.keys(ruleArgs).find(key => fileRelativePath.startsWith(key) || minimatch(fileRelativePath, key));
3939
if (!matchingKey) {

.eslint-plugin-local/code-must-use-result.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as eslint from 'eslint';
7-
import * as ESTree from 'estree';
7+
import type * as ESTree from 'estree';
88
import { TSESTree } from '@typescript-eslint/utils';
99

1010
const VALID_USES = new Set<TSESTree.AST_NODE_TYPES | undefined>([
1111
TSESTree.AST_NODE_TYPES.AwaitExpression,
1212
TSESTree.AST_NODE_TYPES.VariableDeclarator,
1313
]);
1414

15-
export = new class MustUseResults implements eslint.Rule.RuleModule {
15+
export default new class MustUseResults implements eslint.Rule.RuleModule {
1616
readonly meta: eslint.Rule.RuleMetaData = {
1717
schema: false
1818
};
1919

2020
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
2121

22-
const config = <{ message: string; functions: string[] }[]>context.options[0];
22+
const config = context.options[0] as { message: string; functions: string[] }[];
2323
const listener: eslint.Rule.RuleListener = {};
2424

2525
for (const { message, functions } of config) {

.eslint-plugin-local/code-must-use-super-dispose.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import * as eslint from 'eslint';
7-
import * as ESTree from 'estree';
86
import { TSESTree } from '@typescript-eslint/utils';
7+
import * as eslint from 'eslint';
8+
import type * as ESTree from 'estree';
99

10-
export = new class NoAsyncSuite implements eslint.Rule.RuleModule {
10+
export default new class NoAsyncSuite implements eslint.Rule.RuleModule {
1111

1212
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
1313
function doesCallSuperDispose(node: TSESTree.MethodDefinition) {

.eslint-plugin-local/code-no-any-casts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import * as eslint from 'eslint';
77
import { TSESTree } from '@typescript-eslint/utils';
88

9-
export = new class NoAnyCasts implements eslint.Rule.RuleModule {
9+
export default new class NoAnyCasts implements eslint.Rule.RuleModule {
1010

1111
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
1212
return {

.eslint-plugin-local/code-no-dangerous-type-assertions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as eslint from 'eslint';
7-
import * as ESTree from 'estree';
7+
import type * as ESTree from 'estree';
88
import { TSESTree } from '@typescript-eslint/utils';
99

10-
export = new class NoDangerousTypeAssertions implements eslint.Rule.RuleModule {
10+
export default new class NoDangerousTypeAssertions implements eslint.Rule.RuleModule {
1111

1212
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
1313
return {

0 commit comments

Comments
 (0)