Skip to content

Commit

Permalink
chore: setup linting (#3)
Browse files Browse the repository at this point in the history
* bare bones setup

* disable some ts rules

* lint fix build files

* ignore dist

* fix jest global typings

* chore: update yarn.lock
  • Loading branch information
jtoar authored May 7, 2023
1 parent 0e9dbea commit a33f94b
Show file tree
Hide file tree
Showing 14 changed files with 710 additions and 43 deletions.
29 changes: 29 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module.exports = {
root: true,

extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',

// This one has to come last.
// See https://github.com/prettier/eslint-plugin-prettier#recommended-configuration.
'plugin:prettier/recommended',
],

parser: '@typescript-eslint/parser',

plugins: ['@typescript-eslint'],

env: {
node: true,
},

ignorePatterns: ['dist'],

rules: {
'prettier/prettier': 'warn',

'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
}
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,8 @@ jobs:
- name: 🔨 Build
run: yarn build

- name: 🔎 Lint
run: yarn lint

- name: 🧪 Test
run: yarn test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.DS_Store

dist
node_modules

Expand Down
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
}
11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,18 @@
],
"scripts": {
"build": "yarn workspaces foreach --parallel run build",
"lint": "eslint packages",
"test": "yarn workspaces foreach --parallel run test"
},
"devDependencies": {
"@types/jest": "29.5.1",
"@typescript-eslint/eslint-plugin": "5.59.2",
"@typescript-eslint/parser": "5.59.2",
"eslint": "8.40.0",
"eslint-config-prettier": "8.8.0",
"eslint-plugin-prettier": "4.2.1",
"prettier": "2.8.8",
"typescript": "5.0.4"
},
"packageManager": "[email protected]"
}
2 changes: 1 addition & 1 deletion packages/api/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ module.exports = {
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript',
],
};
}
5 changes: 1 addition & 4 deletions packages/api/build.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import * as esbuild from 'esbuild'

await esbuild.build({
entryPoints: [
'src/index.ts',
'src/decoder.ts',
],
entryPoints: ['src/index.ts', 'src/decoder.ts'],
outdir: 'dist',

format: 'cjs',
Expand Down
6 changes: 3 additions & 3 deletions packages/api/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ export default {
// collectCoverageFrom: undefined,

// The directory where Jest should output its coverage files
coverageDirectory: "coverage",
coverageDirectory: 'coverage',

// An array of regexp pattern strings used to skip coverage collection
// coveragePathIgnorePatterns: [
// "/node_modules/"
// ],

// Indicates which provider should be used to instrument code for coverage
coverageProvider: "v8",
coverageProvider: 'v8',

// A list of reporter names that Jest uses when writing coverage reports
// coverageReporters: [
Expand Down Expand Up @@ -192,4 +192,4 @@ export default {

// Whether to use watchman for file crawling
// watchman: true,
};
}
6 changes: 1 addition & 5 deletions packages/setup/build.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import * as esbuild from 'esbuild'

await esbuild.build({
entryPoints: [
'src/index.ts',
'src/setup.ts',
'src/setupHandler.ts',
],
entryPoints: ['src/index.ts', 'src/setup.ts', 'src/setupHandler.ts'],
outdir: 'dist',

format: 'cjs',
Expand Down
2 changes: 1 addition & 1 deletion packages/web/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ module.exports = {
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript',
],
};
}
5 changes: 1 addition & 4 deletions packages/web/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import { resolveToEsbuildTarget } from 'esbuild-plugin-browserslist'
const target = resolveToEsbuildTarget(browserslist('defaults'))

await esbuild.build({
entryPoints: [
'src/index.ts',
'src/clerk.tsx',
],
entryPoints: ['src/index.ts', 'src/clerk.tsx'],
outdir: 'dist',

format: 'cjs',
Expand Down
8 changes: 4 additions & 4 deletions packages/web/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ export default {
// collectCoverageFrom: undefined,

// The directory where Jest should output its coverage files
coverageDirectory: "coverage",
coverageDirectory: 'coverage',

// An array of regexp pattern strings used to skip coverage collection
// coveragePathIgnorePatterns: [
// "/node_modules/"
// ],

// Indicates which provider should be used to instrument code for coverage
coverageProvider: "v8",
coverageProvider: 'v8',

// A list of reporter names that Jest uses when writing coverage reports
// coverageReporters: [
Expand Down Expand Up @@ -144,7 +144,7 @@ export default {
// snapshotSerializers: [],

// The test environment that will be used for testing
testEnvironment: "jsdom",
testEnvironment: 'jsdom',

// Options that will be passed to the testEnvironment
// testEnvironmentOptions: {},
Expand Down Expand Up @@ -192,4 +192,4 @@ export default {

// Whether to use watchman for file crawling
// watchman: true,
};
}
9 changes: 9 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* See https://prettier.io/docs/en/options.html.
* @type {import('prettier').RequiredOptions}
*/
module.exports = {
bracketSpacing: true,
semi: false,
singleQuote: true,
}
Loading

0 comments on commit a33f94b

Please sign in to comment.