Skip to content

Commit

Permalink
Add declaration files
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Deis authored and Nicholas Deis committed Nov 30, 2024
1 parent e5c3980 commit 06bb7da
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 10 deletions.
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ tests/*
*.log
staging/*
.travis.yml
.github/*
.github/*
src/*
tsconfig.json
10 changes: 10 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { Rule } from "eslint";
declare const meta: {
name: string;
version: string;
};
declare const rules: {
"no-pattern-match": Rule.RuleModule;
"no-secrets": Rule.RuleModule;
};
export { meta, rules };
3 changes: 3 additions & 0 deletions dist/no-pattern-match.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type { Rule } from "eslint";
declare const noPatternMatch: Rule.RuleModule;
export default noPatternMatch;
24 changes: 24 additions & 0 deletions dist/regexes.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* From https://github.com/dxa4481/truffleHogRegexes/blob/master/truffleHogRegexes/regexes.json
*/
declare const _default: {
"Slack Token": RegExp;
"RSA private key": RegExp;
"SSH (OPENSSH) private key": RegExp;
"SSH (DSA) private key": RegExp;
"SSH (EC) private key": RegExp;
"PGP private key block": RegExp;
"Facebook Oauth": RegExp;
"Twitter Oauth": RegExp;
GitHub: RegExp;
"Google Oauth": RegExp;
"AWS API Key": RegExp;
"Heroku API Key": RegExp;
"Generic Secret": RegExp;
"Generic API Key": RegExp;
"Slack Webhook": RegExp;
"Google (GCP) Service-account": RegExp;
"Twilio API Key": RegExp;
"Password in URL": RegExp;
};
export default _default;
35 changes: 35 additions & 0 deletions dist/utils.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
export declare const DEFAULT_ADDTIONAL_REGEXES: {};
type PlainObject = {
[key: string | number]: any;
};
export declare function isPlainObject(obj: any): obj is PlainObject;
export declare function plainObjectOption(value: any, name: string, defaultValue: PlainObject): PlainObject;
export declare function validateRecordOfRegex(recordOfRegex: PlainObject): Record<string, RegExp>;
export declare function checkOptions({ tolerance, additionalRegexes, ignoreContent, ignoreModules, ignoreIdentifiers, additionalDelimiters, ignoreCase, }: {
tolerance: any;
additionalRegexes: any;
ignoreContent: any;
ignoreModules: any;
ignoreIdentifiers: any;
additionalDelimiters: any;
ignoreCase: any;
}): {
tolerance: number;
additionalRegexes: Record<string, RegExp>;
ignoreContent: RegExp[];
ignoreModules: any;
ignoreIdentifiers: RegExp[];
additionalDelimiters: RegExp[];
ignoreCase: any;
};
/**
* From https://github.com/dxa4481/truffleHog/blob/dev/truffleHog/truffleHog.py#L85
* @param {*} str
*/
export declare function shannonEntropy(str: string): number;
export declare function isModulePathString(node: any): boolean;
export declare function getIdentifierName(node: any): false | string;
export declare const HIGH_ENTROPY = "HIGH_ENTROPY";
export declare const PATTERN_MATCH = "PATTERN_MATCH";
export declare const FULL_TEXT_MATCH = "FULL_TEXT_MATCH";
export {};
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
{
"name": "eslint-plugin-no-secrets",
"version": "1.4.2",
"version": "2.1.0",
"description": "An eslint rule that searches for potential secrets/keys in code",
"main": "./dist/index.js",
"types": "index.d.ts",
"types": "./dist/index.d.ts",
"scripts": {
"build": "tsc",
"test": "npm run test:unit && npm run build && npm run test:staging",
"test": "npm run test:unit && npm run test:staging",
"test:unit": "ts-node tests/lib/rules",
"test:staging": "node ./staging/staging.spec.js"
"test:staging": "npm run build && node ./staging/staging.spec.js"
},
"keywords": [
"eslint",
"eslint-plugin",
"security",
"secure",
"secrets",
"security",
"lint",
"eslintplugin"
],
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Rule } from "eslint";
import type { Rule, ESLint } from "eslint";
import {
getIdentifierName,
shannonEntropy,
Expand Down Expand Up @@ -34,9 +34,9 @@ function shouldIgnore(value: string, toIgnore) {
return false;
}

const meta = {
const meta: ESLint.Plugin["meta"] = {
name: "eslint-plugin-no-secrets",
version: "1.0.0-eslint9",
version: "2.1.0",
};

const noSecrets: Rule.RuleModule = {
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"forceConsistentCasingInFileNames": true,

"strict": false,
"skipLibCheck": true
"skipLibCheck": true,
"declaration": true
},
"include": [
"./src/**/*"
Expand Down

0 comments on commit 06bb7da

Please sign in to comment.