Skip to content

Commit

Permalink
eslint rules + move tests out of src
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen3H committed Jun 30, 2024
1 parent bb3ff3f commit a8dc299
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 23 deletions.
34 changes: 24 additions & 10 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,42 @@
{
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"plugins": ["@typescript-eslint", "named-import-spacing"],
"root": true,
"env": {
"browser": true,
"es2021": true,
"node": true,
"amd": true,
"es6": true
"commonjs": true,
"browser": true
},
"rules": {
"prefer-const": "warn",
"no-self-compare": "error",
"no-console": "off",
"no-useless-escape": "off",
"no-unused-vars": "off",
"no-undef": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"no-unreachable": ["error"],
"no-unexpected-multiline": ["error"],
"no-constant-condition": "off",
"no-inner-declarations": "off",
"@typescript-eslint/consistent-type-imports": "warn",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": ["warn", {
"args": "all",
"argsIgnorePattern": "^_",
"caughtErrors": "all",
"caughtErrorsIgnorePattern": "^_",
"destructuredArrayIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"ignoreRestSiblings": true
}],
"semi": ["error", "never"],
"no-unreachable": ["error"],
"no-unexpected-multiline": ["error"],
"prefer-const": "warn",
"no-self-compare": "error"
"comma-dangle": ["error", "never"],
"comma-spacing": 2,
"comma-style": 2,
"named-import-spacing/named-import-spacing": 2
}
}
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"@typescript-eslint/parser": "^6.21.0",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
"eslint-plugin-named-import-spacing": "^1.0.3",
"puppeteer": "^22.12.0",
"rimraf": "^5.0.7",
"rollup": "^3.29.4",
Expand Down
4 changes: 2 additions & 2 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const common = {
json(),
resolve({ preferBuiltins: true }),
commonjs({ requireReturnsDefault: 'auto' }),
esbuild(),
],
esbuild()
]
}

const generatedCode = {
Expand Down
5 changes: 2 additions & 3 deletions src/tests/timeline.test.ts → tests/timeline.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/* eslint-disable no-undef */
import { Timeline, TimelineTweet } from '../classes/timeline.js'
import { Timeline, type TimelineTweet } from '../src/classes/timeline.js'

import {
it, describe,
expect, expectTypeOf, assertType,
expect, expectTypeOf, assertType
} from 'vitest'

it('timeline is setup correctly', () => {
Expand Down
7 changes: 3 additions & 4 deletions src/tests/tweet.test.ts → tests/tweet.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* eslint-disable no-undef */
import {
it, describe,
expect, expectTypeOf, assertType
it, expect,
expectTypeOf, assertType
} from 'vitest'

import { Tweet, TweetEmbed } from '../classes/tweet.js'
import { Tweet, type TweetEmbed } from '../src/classes/tweet.js'

it('Tweet is setup correctly', () => {
expect(Tweet).toHaveProperty('get')
Expand Down
5 changes: 3 additions & 2 deletions src/tests/util.test.ts → tests/util.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { buildCookieString } from '../util.js'
import { buildCookieString } from '../src/util.js'

import {
it, describe, expect
it, expect,
describe
} from 'vitest'

describe('util', () => {
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
"tslib" : ["node_modules/tslib/tslib.d.ts"]
}
},
"include": ["src"],
"include": ["src", "tests"],
"exclude": [
"node_modules",
"dist",
"src/tests",
"tests",
"vitest.config.ts",
"rollup.config.mjs"
]
Expand Down

0 comments on commit a8dc299

Please sign in to comment.