文件最后提交记录最后更新时间
Optimize unknown type parsing13 天前
sync 0702 linter5 个月前
Add check and autofix for regex literals1 年前
Update builtin nested scenario26 天前
Fix boundary scenarios1 天前
Optimize unknown type parsing13 天前
Fix boundary scenarios1 天前
Add check and autofix for regex literals1 年前
Fix boundary scenarios1 天前
add pretest codecheck target. add eslint + prettier pipeline for autofixes2 年前
0702 sync 072810 个月前
sync 0702 to master6 个月前
0328 to 04111 年前
add pretest codecheck target. add eslint + prettier pipeline for autofixes2 年前
Update ets2panda documentation3 个月前
Add default and autofix config rule11 个月前
Fixing Numeric Issues with Anonymous Classes3 个月前
update README.md for install and building1 年前
Update build linter11 天前
sync 0702 linter5 个月前
Improve performance of migration mode7 个月前
change npm version to 6.142 个月前
Fix boundary scenarios1 天前
Update builtin nested scenario26 天前
Use standard /usr/bin/env sha-bang in scripts1 年前
Remove image6 个月前
add homecheck and its dependency arkanalyzer1 年前
Issue #19942: Improve linter testing framework1 年前
Use standard /usr/bin/env sha-bang in scripts1 年前
sync 0328 to 060311 个月前
README.md

TypeScript linter

Typescript linter ( further mentioned as 'linter' ) is a tool to check typescript sources and find language elements and constructions which are deprecated to use in a purpose to migrate sources to ETS. The linter is currently under development.

Prerequisits

Visual Studio Code

For development, it's recommended to use VS Code, as it has a full built-in support for TypeScript language.

NodeJS and NPM

Install the latest stable version of Node and NPM. It is recommended to use a Node version manager to install Node and NPM (nvm for Linux; nvm-windows for windows). You can also follow the official guide.

Building

Run the following command to install project dependencies:

npm install

Run the following command to install ohos-typescript:

npm run install-ohos-typescript

Run the following command to build project sources:

npm run build

Running

Run the following command from the same directory:

node dist/tslinter.js [options] [input files]

Note: Before linting a project, it is highly recommended to install all project dependencies (with npm install or any other methods -- depends on the concrete project).

You can also use command files tslinter.sh or tslinter.bat with same arguments as for direct launch.

Possible command options:

--deveco-plugin-mode - this options defines special mode to launch from IDE and should NOT be used when running from command line.

-f, --project-folder <path> - defines path to folder with TypeScript sources and subfolders which linter walks recurscevely. This option may be repeated in command line with different paths.

-p, --project <path> - defines path to TS project configuration file (commonly known as tsconfig.json). If no input file is defined directly as command-line argument, then all source files from tsconfig.json will be processed by linter. Otherwise, linter will only process input files from command-line, that are included into project (i.e. files that belong to intersection of input files from command-line and tsconfig.json file).

-E, --TSC_Errors - enables logging messages about compilation errors and unresolved symbols.

All other command line arguments are considered as paths to TypeScript files.

To prevent command line buffer overflow, response file may be used. It is specified by adding @ prefix to file name (e.g.: tslinter.sh @response-file.txt ). Response file should contain TypeScript source paths (one at each line). The response file argument should be the last command argument (any following argument will be ignored).

Running tests

To run all tests, use the following command:

npm test

To run only certain tests, use the testrunner command with corresponding arguments:

npm run testrunner -- [args]

E.g., the following command:

npm run testrunner -- -d test/main -p {array,object}*

will run the tests in test/main directory that match the glob pattern {array,object}* (i.e. tests that start with array or object)