
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@lint-ts-index/cli
Advanced tools
Purpose of this tool is to check that every files or subdirectories are exported in their corresponding index.ts files.
$ lint-ts-index
foo.ts is not exported in index.ts
If you believe it's an error, please add an exclusion in .indexignore
Have you ever forget to export the content of a new source file into the index.ts file of it's parent directory? Not anymore!
:warning: This project is still experimental and subject to important changes. Use it at your own risk
Please note that lint-ts-index also exists as an eslint plugin. If you already use the linter in your project, it might be a better choice to use it.
Also, since you might prefer a to use a specific version of the compiler, the typescript package is not installed automatically as a dependency of @lint-ts-index/cli. Which means that you must also install it by yourself alongside the tool.
npm install --global @lint-ts-index/cli
Append typescript at the end of the line if it's not already installed globally.
Install the tool and add it to your package.json as a devDependency with:
npm install --save-dev @lint-ts-index/cli
Append typescript at the end of the line if it's not already installed in your project.
Then it's preferable to add this NPM script in your package.json file so that you can call the linter with npm run lint:ts-index:
{
"scripts": {
"lint:ts-index": "lint-ts-index",
// You can also call the command from your existing lint script.
"lint": "lint-ts-index && prettier"
// ...
}
// ...
}
Usage: lint-ts-index [options] [directory]
Check that every files or subdirectories are exported in their corresponding index.ts files.
Arguments:
directory The directory to search recursively for index.ts files
Options:
-c, --config <file> Use this configuration overriding .lint-ts-index.*
config options if present
-f, --fix (Experimental) Automatically export the missing sources
in their index.ts
--version Output version information and exit
-h, --help Display help for command
npx @lint-ts-index/cli
Given the following directory:
examples/simple/fail
├── bar.ts
├── foo.ts
└── index.ts
And index.ts content:
export * from './bar';
Calling lint-ts-index would exit with a non-zero exit code and output the following:
$ lint-ts-index
foo.ts is not exported in index.ts
If you believe it's an error, please add an exclusion in .indexignore
To fix this error, you can either add the missing export * from './foo'; line in index.ts or add a .indexignore file to ignore the file from the list of modules which must be exported.
Let's say that, in our case, we don't want to export the file. Then, content of the .indexignore, would have the following content:
foo.ts
Once the corrections are applied, the linter should output nothing and have a successful exit code.
Given the following directory:
examples/advanced/fail
├── bar.ts
├── command-line
│ ├── helper.ts
│ ├── index.ts
│ └── plugin-api
│ ├── context.ts
│ ├── factory.ts
│ └── index.ts
├── foo.ts
├── index.ts
├── private
│ └── secret.ts
└── public
├── index.ts
├── private-file.ts
└── public-file.ts
Specific requirements:
advanced should be exported in index.ts.foo.ts contains only private functions which we don't want to expose in the public API.command-line is the code for a command-line tool.
command-line/index.ts contains the main entry point and should not be loaded as a library.command-line/helper.ts is some internal utility functions used by command-line/index.ts.command-line/plugin-api will be exposed publicly in a specific plugin API.private has some secret functions in it which we don't want to expose in the public API.public contains most of the public interfaces which must be exposed in the public API.
We want to check that every file in it gets exported in public/index.ts
public/private-file.ts is a file which we don't want to expose in the public API although it is placed in the public directory.As-is, the lint-ts-index output would look like this:
$ lint-ts-index
foo.ts is not exported in index.ts
command-line is not exported in index.ts
private is not exported in index.ts
command-line/helper.ts is not exported in command-line/index.ts
command-line/plugin-api is not exported in command-line/index.ts
public/private-file.ts is not exported in public/index.ts
If you believe it's an error, please add an exclusion in .indexignore
Because we need to respect the rules above, the solution here is not to export the reported files and directories. We have to write a .indexignore file with these lines:
foo.ts
private
command-line
command-line/index.ts
public/private-file.ts
Then, the linter should pass and still detect new additions in the directories whose content should be exported by default.
See Configuration File Formats.
@lint-ts-index/eslint-plugin - Use lint-ts-index as an ESLint rule.@lint-ts-index/core - The core library behind this command-line tool.This project is licensed under the MIT license which you can find a copy in the LICENSE file.
FAQs
Check whether TS files are exported in index.ts
We found that @lint-ts-index/cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.