Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
eslint-config-airbnb-ts
Advanced tools
Adds typescript support to Airbnb's ESLint config
use this project instead https://github.com/iamturns/eslint-config-airbnb-typescript as it now supports peerDependencies for airbnb-base
Airbnb's ESLint config with TypeScript support
This started as a fork from https://github.com/iamturns/eslint-config-airbnb-typescript
this libary requires that typescript and eslint are installed
npm install @typescript-eslint/eslint-plugin @typescript-eslint/parser --save-dev
make sure you have a tsconfig.json that includes the files you want to lint or look further down if you want to create a separate tsconfig for defining which files to lint.
npm install eslint-config-airbnb-ts --save-dev
Add "extends": ["airbnb-ts"]
to your ESLint config file.
An example .eslintrc.js
:
module.exports = {
extends: ['airbnb-ts'],
};
Also note that we're enabling @typescript-eslint/eslint-plugin's recommended rules by default You can turn them off if you want but since they're recommended they should probably be enabled.
This config requires knowledge of your TypeScript config.
In your ESLint config, set parserOptions.project to the path of your tsconfig.json
.
For example:
module.exports = {
extends: ['airbnb-ts'],
+ parserOptions: {
+ project: './tsconfig.json',
+ }
};
Open a terminal to the root of your project, and run the following command:
npx eslint . --ext .js,.jsx,.ts,.tsx
ESLint will lint all .js, .jsx, .ts, and .tsx files within the current folder, and output results to your terminal.
You can also get results in realtime inside most IDEs via a plugin.
Yep! This config is just decorating eslint-config-airbnb
with TypeScript support.
This means you are attempting to lint a file that tsconfig.json
doesn't include.
A common fix is to create a tsconfig.eslint.json
file, which extends your tsconfig.json
file and includes all files you are linting.
{
"extends": "./tsconfig.json",
"include": ["src/**/*.ts", "src/**/*.js", "test/**/*.ts"]
}
Update your ESLint config file:
parserOptions: {
- project: './tsconfig.json',
+ project: './tsconfig.eslint.json',
}
The goal of eslint-config-airbnb-ts
is to simply decorate eslint-config-airbnb
with TypeScript support. It's not a single config to cater for all TypeScript linting requirements. For additional functionality, alter your ESLint config file. For example:
module.exports = {
extends: [
'airbnb-ts',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'prettier',
],
};
Authored by Matt Turnbull (iamturns.com / @iamturns)
Maintained by Anders Nilsson (nilssonanders79@gmail.com)
A big thank you to all contributors!
Open source licensed as MIT.
FAQs
Adds typescript support to Airbnb's ESLint config
The npm package eslint-config-airbnb-ts receives a total of 0 weekly downloads. As such, eslint-config-airbnb-ts popularity was classified as not popular.
We found that eslint-config-airbnb-ts 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.