Skip to content

Commit

Permalink
Symbolic Analysis (#3)
Browse files Browse the repository at this point in the history
## Features

### Symbolic Analysis with extended validation

* Improved Hovers
  - Controllers show a neat list of operations
  - Receivers show security and parent controller information

* Annotation context validation
  - Receivers may not have `@Tag` annotations
  - Controllers may not have `@Method`, `@Query`, `@Path` or `@Body` annotations
  
* Annotation link validation
  -  Each URL parameter may only appear once
  -  Each URL parameter must have a matching `@Path` annotation
  -  Each `@Path` annotation must link to a `@Route` URL parameter via *Alias* or *Value*
  -  Each `@Path` annotation must link to a function parameter via *Value*
  -  `@Path` annotation values must be unique
  -  `@Path` annotation aliases must be unique
  -  Each function parameter must be referenced by *exactly* one `@Path`/`@Query`/`@Header`/`@Body` annotation

* `gleece.config.json` linting (via JSON schema)

* Support for `TemplateContext` annotations

* Dedicated log output channel `gleece`

* Additional configuration options

----------------------
### Under the hood

* Revamped activation/deactivation to a 'context' approach
* Greatly expanded configuration support
* Replace `eslint` with latest and working config
* Removed dead task from `tasks.json`
* Added a markdown factory function with a React-like interface for creating tables
* Aligned definitions to match current Gleece core 
* Bumped minor to 1.2.0

#### Performance related notes
Observed the following activation/processing latency:

* Activation
  - Arch-based  - ~170ms
  - Windows 11 - ~700ms

* Full diagnostics with semantics - Initial
  - Arch-based  - ~160ms
  - Windows 11 - ~600ms

* Full diagnostics with semantics - Subsequent
  - Arch-based  - ~20ms
  - Windows 11 - ~20ms
  • Loading branch information
yuval-po authored Feb 22, 2025
1 parent 1d97c6c commit 18e147b
Show file tree
Hide file tree
Showing 39 changed files with 2,409 additions and 871 deletions.
24 changes: 0 additions & 24 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
"preLaunchTask": "tasks: watch-tests"
}
]
}
}
21 changes: 1 addition & 20 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,5 @@
"isDefault": true
}
},
{
"type": "npm",
"script": "watch-tests",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never",
"group": "watchers"
},
"group": "build"
},
{
"label": "tasks: watch-tests",
"dependsOn": [
"npm: watch",
"npm: watch-tests"
],
"problemMatcher": []
}
]
}
}
93 changes: 93 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import eslint from '@eslint/js';
import tsEslint from 'typescript-eslint';
import stylisticPlugin from '@stylistic/eslint-plugin';

export default tsEslint.config(
{
ignores: ['eslint.config.mjs', 'webpack.config.js', '.yarn', 'dist', 'coverage', '*/generated/*'],
},
eslint.configs.recommended,
...tsEslint.configs.recommendedTypeChecked,
{
files: ["**/*.ts"],
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
ecmaVersion: 2024

},
},
plugins: {
'@stylistic': stylisticPlugin,
},
rules: {
'import/prefer-default-export': 'off',
'arrow-body-style': 'off',
'class-methods-use-this': 'off',
'no-restricted-syntax': 'off',
'no-continue': 'off',
'no-console': 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'import/no-unresolved': 'off',
'max-len': ['error', { 'code': 155, 'ignoreRegExpLiterals': true }],
'no-multiple-empty-lines': ['error', { 'max': 2, 'maxEOF': 1 }],
'no-tabs': 'off',
'@typescript-eslint/indent': 'off',
'@stylistic/comma-dangle': ['error', {
'arrays': 'never',
'objects': 'never',
'imports': 'never',
'exports': 'never',
'functions': 'never'
}],
'padded-blocks': 'off',
'no-lonely-if': 'off',
'no-plusplus': 'off',
'no-underscore-dangle': 'off',
'spaced-comment': ['error', 'always', {
'line': {
'markers': ['#region', '#endregion']
}
}],
'object-curly-newline': ['error', { 'ImportDeclaration': { 'minProperties': 5 } }],
'@stylistic/eol-last': ['error', 'always'],
'@stylistic/no-trailing-spaces': 'error',
'@stylistic/semi': ['error', 'always'],
'@stylistic/quotes': ['error', 'single', { "avoidEscape": true }],
'@stylistic/no-multi-spaces': ['error', { 'ignoreEOLComments': true }],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-namespace': 'off', // Personally like namespaces as static function containers
'@typescript-eslint/no-unsafe-member-access': 'off', // Not ideal but we're manipulating low level constructs here so its quite inconvenient
'@typescript-eslint/no-unsafe-argument': 'off', // Same deal as above
'@typescript-eslint/no-unused-vars': [
'error',
{
'args': 'all',
'argsIgnorePattern': '^_',
'caughtErrors': 'all',
'caughtErrorsIgnorePattern': '^_',
'destructuredArrayIgnorePattern': '^_',
'varsIgnorePattern': '^_',
'ignoreRestSiblings': true
}
]
},
},
{
files: ["builder/**/*.ts"],
rules: {
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/restrict-template-expressions': 'off'
},
},
{
files: ["test/**/*.ts"],
rules: {
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
},
},
);
Loading

0 comments on commit 18e147b

Please sign in to comment.