Skip to content

Commit

Permalink
Merge pull request #112 from mithodin/migrate-to-eslint
Browse files Browse the repository at this point in the history
chore: replace tslint with eslint
  • Loading branch information
jwalton committed Jul 27, 2023
2 parents ea91573 + 68f15e8 commit fdf1313
Show file tree
Hide file tree
Showing 4 changed files with 256 additions and 44 deletions.
244 changes: 244 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,244 @@
module.exports = {
env: {
es6: true,
node: true,
},
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier",
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: ["./tsconfig.json", "./test/tsconfig.json"],
sourceType: "module",
},
plugins: [
"eslint-plugin-prefer-arrow",
"eslint-plugin-import",
"eslint-plugin-jsdoc",
"@typescript-eslint",
],
root: true,
rules: {
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": [
"error",
{
default: "array",
},
],
"@typescript-eslint/ban-types": [
"error",
{
types: {
Object: {
message: "Avoid using the `Object` type. Did you mean `object`?",
},
Function: {
message:
"Avoid using the `Function` type. Prefer a specific function type, like `() => void`.",
},
Boolean: {
message: "Avoid using the `Boolean` type. Did you mean `boolean`?",
},
Number: {
message: "Avoid using the `Number` type. Did you mean `number`?",
},
String: {
message: "Avoid using the `String` type. Did you mean `string`?",
},
Symbol: {
message: "Avoid using the `Symbol` type. Did you mean `symbol`?",
},
},
},
],
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-member-accessibility": [
"off",
{
accessibility: "explicit",
},
],
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/member-ordering": "off",
"@typescript-eslint/naming-convention": [
"off",
{
selector: "variable",
format: ["camelCase", "UPPER_CASE"],
leadingUnderscore: "allow",
trailingUnderscore: "forbid",
},
],
"@typescript-eslint/no-empty-function": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-parameter-properties": "off",
"@typescript-eslint/no-shadow": [
"off",
{
hoist: "all",
},
],
"@typescript-eslint/no-unused-expressions": "error",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-function-type": "off",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/quotes": [
"off",
"single",
{
avoidEscape: true,
},
],
"@typescript-eslint/triple-slash-reference": [
"error",
{
path: "always",
types: "prefer-import",
lib: "always",
},
],
"@typescript-eslint/type-annotation-spacing": "off",
"@typescript-eslint/typedef": "off",
"@typescript-eslint/unified-signatures": "error",
"arrow-parens": ["off", "always"],
"comma-dangle": "off",
complexity: "off",
"constructor-super": "error",
"dot-notation": "off",
"eol-last": "off",
eqeqeq: ["error", "smart"],
"guard-for-in": "error",
"id-denylist": [
"error",
"any",
"Number",
"number",
"String",
"string",
"Boolean",
"boolean",
"Undefined",
"undefined",
],
"id-match": "error",
"import/order": [
"off",
{
alphabetize: {
caseInsensitive: true,
order: "asc",
},
"newlines-between": "ignore",
groups: [
["builtin", "external", "internal", "unknown", "object", "type"],
"parent",
["sibling", "index"],
],
distinctGroup: false,
pathGroupsExcludedImportTypes: [],
pathGroups: [
{
pattern: "./",
patternOptions: {
nocomment: true,
dot: true,
},
group: "sibling",
position: "before",
},
{
pattern: ".",
patternOptions: {
nocomment: true,
dot: true,
},
group: "sibling",
position: "before",
},
{
pattern: "..",
patternOptions: {
nocomment: true,
dot: true,
},
group: "parent",
position: "before",
},
{
pattern: "../",
patternOptions: {
nocomment: true,
dot: true,
},
group: "parent",
position: "before",
},
],
},
],
"jsdoc/check-alignment": "error",
"jsdoc/check-indentation": "off",
"max-classes-per-file": "off",
"new-parens": "error",
"no-bitwise": "error",
"no-caller": "error",
"no-cond-assign": "error",
"no-console": "error",
"no-debugger": "error",
"no-empty": "error",
"no-empty-function": "off",
"no-eval": "error",
"no-fallthrough": "off",
"no-invalid-this": "off",
"no-new-wrappers": "error",
"no-shadow": "off",
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-undef-init": "error",
"no-underscore-dangle": "off",
"no-unsafe-finally": "error",
"no-unused-expressions": "off",
"no-unused-labels": "error",
"no-use-before-define": "off",
"no-var": "error",
"object-shorthand": "off",
"one-var": ["error", "never"],
"prefer-arrow/prefer-arrow-functions": "off",
"prefer-const": "error",
"quote-props": "off",
quotes: "off",
radix: "error",
"spaced-comment": [
"error",
"always",
{
markers: ["/"],
},
],
"use-isnan": "error",
"valid-typeof": "off",
},
overrides: [
{
files: ["./test/**/*.ts"],
rules: {
"no-unused-expressions": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/require-await": "off",
},
},
],
};
17 changes: 12 additions & 5 deletions package.json
Expand Up @@ -15,18 +15,18 @@
"test:unittest": "tsc -p test && nyc mocha 'test/**/*.@(ts|js)'",
"precommit:unittest": "tsc -p test && mocha --reporter progress 'test/**/*.@(ts|js)'",
"lint": "npm run lint:source && npm run lint:tests",
"lint:source": "tslint -c tslint.json -t stylish 'src/**/*.ts'",
"lint:tests": "tslint -c test/tslint.json -t stylish 'test/**/*.ts'",
"lint:source": "eslint -f stylish 'src/**/*.ts'",
"lint:tests": "eslint -f stylish 'test/**/*.ts'",
"prepare": "husky install && npm run build",
"prepublishOnly": "npm run build && npm test",
"semantic-release": "semantic-release"
},
"lint-staged": {
"src/**/*.ts": [
"tslint -c tslint.json -t stylish"
"eslint -f stylish --fix"
],
"test/**/*.ts": [
"tslint -c test/tslint.json -t stylish"
"eslint -f stylish --fix"
]
},
"repository": {
Expand Down Expand Up @@ -58,19 +58,26 @@
"@types/express": "^4.16.1",
"@types/mocha": "^9.0.0",
"@types/node": "^18.7.23",
"@typescript-eslint/eslint-plugin": "^6.1.0",
"@typescript-eslint/parser": "^6.1.0",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"coveralls": "^3.0.3",
"eslint": "^8.45.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsdoc": "^46.4.4",
"eslint-plugin-prefer-arrow": "^1.2.3",
"express": "^4.16.4",
"husky": "^7.0.4",
"lint-staged": "^12.1.2",
"mocha": "^10.2.0",
"nyc": "^15.0.1",
"prettier": "^3.0.0",
"pretty-quick": "^3.1.2",
"semantic-release": "^19.0.5",
"supertest-fetch": "^1.2.4",
"ts-node": "^10.4.0",
"tslint": "^6.1.3",
"typescript": "^4.2.4"
},
"greenkeeper": {
Expand Down
9 changes: 0 additions & 9 deletions test/tslint.json

This file was deleted.

30 changes: 0 additions & 30 deletions tslint.json

This file was deleted.

0 comments on commit fdf1313

Please sign in to comment.