Kwjsspec
The kwjsspec command creates a JavaScript build specification based on the arguments you pass to it.
Prerequisites
Before you can create a build specification, you need to install the Server package. See Installing Klocwork.
For more information, see Creating a JavaScript build specification.
Usage
kwjsspec [options] [<folder or file> ...]
where:
-
<options>
are any arguments required for your build, and -
<folder or file> is an analysis location specified for the build. If no location is specified, the current working directory is used.
You can also specify a 'kwjsspec.out' option file:
kwjsspec @kwjsspec.opt
where 'kwjsspec.opt' is a file containing the arguments in separate lines. Below is an example of a kwjsspec.opt file:
--ecma-version 12 --framework vue --environment node --babel
Options
Name (and short name) | Description |
---|---|
--help (-h) | display help |
--version | display kwjsspec version |
--output <file> (-o) | write the build specification to <file>. By default, the build specification is written to kwjsspec.out in the current working directory. |
--ecma-version <integer> (-v) | set the ECMA version; The default is version 12. |
--use-modules (-m) | specify JavaScript modules used by your project; If your project uses the JavaScript modules, include this option. |
--framework <string> (-w) | Select the framework you would like to use. Use --list-frameworks to view a list of supported frameworks. If your project uses one of the listed frameworks, include this option. |
--typescript (-t) | specify this option if your project uses TypeScript |
--babel (-b) | specify this option if your project uses Babel |
--environment <string> (-e) | add global variables based on your specific environment. Use --list-environments to view a list of supported environments. |
--global-return (-g) | allows return statements in the global scope. If your project has return statements in the global scope, include this option |
--strict | enable global strict mode if ecma-version is greater than 5. |
--jsx | enable JSX. If you have JSX present in your project, include this option. |
--ignore <string> (-i) | add global patterns to ignore files or folders that should not be analyzed |
--ignores-file <string> (-x) |
specify a file that includes a list of all files or folders that should not be analyzed. The --ignores-file option runs by default in the background against the project's .eslintignore file, irrespective of working directory. For more information, see --ignores-file default for .eslintignore file from a different working directory. |
--list-environments | outputs a list of the supported environments |
--list-frameworks | outputs a list of the supported frameworks |
--ignores-file default for .eslintignore file from a different working directory
At the time of build specification generation using the kwjsspec command, when the build specification is created from outside of the JavaScript source directory, the command will look for the .eslintignore file at project root directory and pass it to build specification with the --ignores-file option.
For instance, if you run the following command from outside of D:\projects\joplin:
kwjsspec -e node -e es6 -e browser -v 2018 -m --typescript -w react D:\projects\joplin
the kwjsspec command will create the build specification as if you are running:
kwjsspec -e node -e es6 -e browser -v 2018 -m --typescript -w react D:\projects\joplin --ignores-file D:\projects\joplin\.eslintignore