Giter VIP home page Giter VIP logo

Comments (4)

crystalfp avatar crystalfp commented on May 24, 2024

Seems I found the cause. This file contains a class with a big method (~600 lines). For test I shortened it to < 200 lines and the error disappeared. Now I will try to refactor this routine, well, not only to solve this problem.
Anyway, at least returning the error to the user could help a lot!
Thanks
mario

from madge.

crystalfp avatar crystalfp commented on May 24, 2024

Unfortunately the refactoring changed nothing. Same error from madge --debug.

Finding files
2023-03-20T09:51:20.667Z madge using src paths [ 'D:\\Projects\\VUEIdeaIgniterEnvironment\\server\\server\\Routes.ts' ]
2023-03-20T09:51:20.669Z madge using config { baseDir: './server', excludeRegExp: false, fileExtensions: [ 'ts' ], includeNpm: false, requireConfig: null, webpackConfig: null, tsConfig: { compilerOptions: { target: 'esnext', module: 'esnext', lib: [Array], sourceMap: true, incremental: true, removeComments: true, strict: true, alwaysStrict: true, useDefineForClassFields: true, noUnusedLocals: true, noUnusedParameters: true, noImplicitReturns: true, moduleResolution: 'node', allowSyntheticDefaultImports: true, esModuleInterop: true, resolveJsonModule: true, forceConsistentCasingInFileNames: true, importsNotUsedAsValues: 'remove', strictNullChecks: true }, include: [ '*', '../common/*' ], exclude: [ './node_modules', './tests' ] }, rankdir: 'LR', layout: 'dot', fontName: 'Arial', fontSize: '14px', backgroundColor: '#111111', nodeColor: '#c6c5fe', nodeShape: 'box', nodeStyle: 'rounded', noDependencyColor: '#cfffac', cyclicNodeColor: '#ff6c60', edgeColor: '#757575', graphVizOptions: false, graphVizPath: false, dependencyFilter: [Function (anonymous)], debug: true, detectiveOptions: { ts: { skipTypeImports: false } }, version: [Function: version] }
2023-03-20T09:51:22.356Z madge using base directory D:\Projects\VUEIdeaIgniterEnvironment\server\server
2023-03-20T09:51:22.358Z tree given filename: D:\Projects\VUEIdeaIgniterEnvironment\server\server\Routes.ts
2023-03-20T09:51:22.358Z tree resolved filename: D:\Projects\VUEIdeaIgniterEnvironment\server\server\Routes.ts
2023-03-20T09:51:22.358Z tree visited:  {}
2023-03-20T09:51:22.358Z tree traversing D:\Projects\VUEIdeaIgniterEnvironment\server\server\Routes.ts
2023-03-20T09:51:22.360Z typescript-eslint:typescript-estree:createSourceFile Getting AST without type information in TS mode for: D:\Projects\VUEIdeaIgniterEnvironment\server\estree.ts
2023-03-20T09:51:22.397Z tree error getting dependencies: Expression expected.
2023-03-20T09:51:22.398Z tree TSError: Expression expected.
    at createError (c:\Users\mvalle\AppData\Roaming\npm\node_modules\madge\node_modules\@typescript-eslint\typescript-estree\dist\node-utils.js:539:12)
    at convertError (c:\Users\mvalle\AppData\Roaming\npm\node_modules\madge\node_modules\@typescript-eslint\typescript-estree\dist\convert.js:41:41)
    at astConverter (c:\Users\mvalle\AppData\Roaming\npm\node_modules\madge\node_modules\@typescript-eslint\typescript-estree\dist\ast-converter.js:15:42)
    at parseWithNodeMapsInternal (c:\Users\mvalle\AppData\Roaming\npm\node_modules\madge\node_modules\@typescript-eslint\typescript-estree\dist\parser.js:65:66)
    at Object.parse (c:\Users\mvalle\AppData\Roaming\npm\node_modules\madge\node_modules\@typescript-eslint\typescript-estree\dist\parser.js:43:21)
    at module.exports.parse (c:\Users\mvalle\AppData\Roaming\npm\node_modules\madge\node_modules\node-source-walk\index.js:64:22)
    at module.exports.walk (c:\Users\mvalle\AppData\Roaming\npm\node_modules\madge\node_modules\node-source-walk\index.js:108:42)
    at module.exports (c:\Users\mvalle\AppData\Roaming\npm\node_modules\madge\node_modules\detective-typescript\index.js:33:10)
    at precinct (c:\Users\mvalle\AppData\Roaming\npm\node_modules\madge\node_modules\dependency-tree\node_modules\precinct\index.js:108:20)
    at precinct.paperwork (c:\Users\mvalle\AppData\Roaming\npm\node_modules\madge\node_modules\dependency-tree\node_modules\precinct\index.js:161:16)
2023-03-20T09:51:22.398Z tree cabinet-resolved all dependencies:  []
2023-03-20T09:51:22.398Z tree using filter function to filter out dependencies
2023-03-20T09:51:22.398Z tree unfiltered number of dependencies: 0
2023-03-20T09:51:22.398Z tree filtered number of dependencies: 0
2023-03-20T09:51:22.398Z tree traversal complete {}
2023-03-20T09:51:22.398Z tree deduped list of nonExistent partials:  []
2023-03-20T09:51:22.398Z tree object form of results requested
2023-03-20T09:51:22.398Z tree final tree {
  'D:\\Projects\\VUEIdeaIgniterEnvironment\\server\\server\\Routes.ts': {}
}

Well, at least my class now looks better...

from madge.

dr-vortex avatar dr-vortex commented on May 24, 2024

I'm getting a different error...

⠋ Finding files  madge using src paths [ 'D:\\blankstorm\\src\\client\\index.ts' ] +0ms
  madge using config { baseDir: null, excludeRegExp: false, fileExtensions: [ 'ts' ], includeNpm: false, requireConfig: null, webpackConfig: null, tsConfig: null, rankdir: 'LR', layout: 'dot', fontName: 'Arial', fontSize: '14px', backgroundColor: '#111111', nodeColor: '#c6c5fe', nodeShape: 'box', nodeStyle: 'rounded', noDependencyColor: '#cfffac', cyclicNodeColor: '#ff6c60', edgeColor: '#757575', graphVizOptions: false, graphVizPath: false, dependencyFilter: [Function (anonymous)], detectiveOptions: { ts: { skipTypeImports: true } }, image: 'C:/Users/preve/Pictures/Blankstorm/Deps/client.svg', extensions: 'ts', debug: true, version: [Function: version] } +2ms
  madge using base directory D:/blankstorm/src/client +2ms
  tree given filename: D:\blankstorm\src\client\index.ts +0ms
  tree resolved filename: D:\blankstorm\src\client\index.ts +0ms
  tree visited:  {} +0ms
  tree traversing D:\blankstorm\src\client\index.ts +0ms
  typescript-eslint:typescript-estree:createSourceFile Getting AST without type information in TS mode for: D:\blankstorm\estree.ts +0ms
  tree error getting dependencies: Property or signature expected. +33ms
  tree TSError: Property or signature expected.
  tree     at createError (C:\Users\preve\AppData\Roaming\nvm\v18.14.0\node_modules\madge\node_modules\@typescript-eslint\typescript-estree\dist\node-utils.js:529:12)
  tree     at convertError (C:\Users\preve\AppData\Roaming\nvm\v18.14.0\node_modules\madge\node_modules\@typescript-eslint\typescript-estree\dist\convert.js:41:41)
  tree     at astConverter (C:\Users\preve\AppData\Roaming\nvm\v18.14.0\node_modules\madge\node_modules\@typescript-eslint\typescript-estree\dist\ast-converter.js:15:42)
  tree     at parseWithNodeMapsInternal (C:\Users\preve\AppData\Roaming\nvm\v18.14.0\node_modules\madge\node_modules\@typescript-eslint\typescript-estree\dist\parser.js:65:66)
  tree cabinet-resolved all dependencies:  [] +2ms
  tree using filter function to filter out dependencies +0ms
  tree unfiltered number of dependencies: 0 +0ms
  tree filtered number of dependencies: 0 +0ms
  tree traversal complete {} +1ms
  tree deduped list of nonExistent partials:  [] +0ms
  tree object form of results requested +0ms
  tree final tree { 'D:\\blankstorm\\src\\client\\index.ts': {} } +0ms
✔ Image created at C:\Users\preve\Pictures\Blankstorm\Deps\client.svg

Imports (TypeScript)

import { Vector2, Vector3 } from '@babylonjs/core/Maths/math.vector';
import { Color3 } from '@babylonjs/core/Maths/math.color';
import { Engine } from '@babylonjs/core/Engines/engine';
import $ from 'jquery';
$.ajaxSetup({ timeout: 3000 });

import { GAME_URL, config, version, versions } from '../core/meta';
import { isHex, isJSON, random, xpToLevel } from '../core/utils';
import { commands, execCommandString } from '../core/commands';
import * as api from '../core/api';
import { Ship } from '../core/entities/Ship';
import type { Player } from '../core/entities/Player';
import type { Entity } from '../core/entities/Entity';
import type { ShipType } from '../core/generic/ships';
import { Level } from '../core/Level';
import { Keybind, SettingsMap } from './settings';
import { LocaleStore } from './locales';
import { upload, minimize, alert, cookies } from './utils';
import { Waypoint } from './waypoint';
import { SaveMap, Save, LiveSave } from './Save';
import { ServerMap, Server } from './Server';
import fs from './fs';
import * as ui from './ui/ui';
import { sounds, playsound } from './audio';
import * as renderer from '../renderer/index';

The file is 956 lines and worked fine when it was JavaScript.

from madge.

NutchapolSal avatar NutchapolSal commented on May 24, 2024

I think it might have to do with Madge's Typescript being older than your project's Typescript, and also that the dependencies are not returned when a TSError occurs (so it thinks that the file is a leaf node)

Explicitly installing Typescript into npm -g (instead of relying on having it from peer dependencies) seems to fix the problem

from madge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.