From 90c25d9ece85e410888550aa9a7d4a16f5b8c0f6 Mon Sep 17 00:00:00 2001 From: Manu MA Date: Mon, 20 Jun 2022 21:43:19 +0100 Subject: [PATCH] fix: add eslint config (#649) --- .eslintignore | 1 + package.json | 2 +- packages/create-qwik/package.json | 2 +- packages/docs/package.json | 2 +- packages/eslint-plugin-qwik/README.md | 5 +++ packages/eslint-plugin-qwik/index.ts | 1 + packages/eslint-plugin-qwik/package.json | 2 +- packages/qwik-city/package.json | 2 +- packages/qwik/package.json | 2 +- scripts/cli.ts | 1 + starters/apps/base/.eslintignore | 30 ++++++++++++++++++ starters/apps/base/.eslintrc.js | 39 ++++++++++++++++++++++++ yarn.lock | 12 ++++---- 13 files changed, 89 insertions(+), 12 deletions(-) create mode 100644 starters/apps/base/.eslintignore create mode 100644 starters/apps/base/.eslintrc.js diff --git a/.eslintignore b/.eslintignore index 52aef99c551..34a23870a72 100644 --- a/.eslintignore +++ b/.eslintignore @@ -16,3 +16,4 @@ tsdoc-metadata.json scripts/**/* *.tsbuildinfo packages/docs/src/pages/examples/**/* +vite.config.ts diff --git a/package.json b/package.json index cd3f3fed2bd..4e4d9160841 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "qwik-monorepo", - "version": "0.0.28", + "version": "0.0.29", "scripts": { "build": "yarn node scripts --tsc --build --api --platform-binding-wasm-copy", "build.full": "yarn node scripts --tsc --build --api --eslint --qwikcity --platform-binding --wasm", diff --git a/packages/create-qwik/package.json b/packages/create-qwik/package.json index 9bcc490a42f..606da689727 100644 --- a/packages/create-qwik/package.json +++ b/packages/create-qwik/package.json @@ -1,6 +1,6 @@ { "name": "create-qwik", - "version": "0.0.28", + "version": "0.0.29", "description": "Interactive CLI and API for generating Qwik projects.", "bin": "create-qwik", "main": "index.js", diff --git a/packages/docs/package.json b/packages/docs/package.json index f1862bfdc6f..17d7dd65e50 100644 --- a/packages/docs/package.json +++ b/packages/docs/package.json @@ -19,7 +19,7 @@ }, "devDependencies": { "@builder.io/partytown": "^0.6.1", - "@builder.io/qwik": "0.0.27", + "@builder.io/qwik": "0.0.28", "@builder.io/qwik-city": "0.0.12", "@cloudflare/kv-asset-handler": "0.2.0", "autoprefixer": "10.4.7", diff --git a/packages/eslint-plugin-qwik/README.md b/packages/eslint-plugin-qwik/README.md index 212071a9cff..13fa15ec321 100644 --- a/packages/eslint-plugin-qwik/README.md +++ b/packages/eslint-plugin-qwik/README.md @@ -1 +1,6 @@ # eslint-plugin-qwik + +## Implemented + +- `no-use-after-await` (deprecated) +- `valid-lexical-scope` diff --git a/packages/eslint-plugin-qwik/index.ts b/packages/eslint-plugin-qwik/index.ts index 6014865609c..42a035b0d57 100644 --- a/packages/eslint-plugin-qwik/index.ts +++ b/packages/eslint-plugin-qwik/index.ts @@ -11,6 +11,7 @@ export const configs = { plugins: ['qwik'], rules: { 'qwik/no-use-after-await': 'error', + 'qwik/valid-lexical-scope': 'error', }, }, strict: { diff --git a/packages/eslint-plugin-qwik/package.json b/packages/eslint-plugin-qwik/package.json index 3c8d94b0124..df68720a24f 100644 --- a/packages/eslint-plugin-qwik/package.json +++ b/packages/eslint-plugin-qwik/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-qwik", - "version": "0.0.28", + "version": "0.0.29", "description": "An Open-Source sub-framework designed with a focus on server-side-rendering, lazy-loading, and styling/animation.", "main": "index.js", "author": "Builder Team", diff --git a/packages/qwik-city/package.json b/packages/qwik-city/package.json index 5c3c09e33e0..5cc3d8a1d57 100644 --- a/packages/qwik-city/package.json +++ b/packages/qwik-city/package.json @@ -19,7 +19,7 @@ "@builder.io/qwik": ">=0.0.22" }, "devDependencies": { - "@builder.io/qwik": "0.0.27", + "@builder.io/qwik": "0.0.28", "@microsoft/api-extractor": "7.24.2", "@types/github-slugger": "^1.3.0", "@types/marked": "^4.0.3", diff --git a/packages/qwik/package.json b/packages/qwik/package.json index bef02dd6ce1..de9d93ce656 100644 --- a/packages/qwik/package.json +++ b/packages/qwik/package.json @@ -1,6 +1,6 @@ { "name": "@builder.io/qwik", - "version": "0.0.28", + "version": "0.0.29", "description": "An Open-Source sub-framework designed with a focus on server-side-rendering, lazy-loading, and styling/animation.", "main": "./dist/core.cjs", "module": "./dist/core.mjs", diff --git a/scripts/cli.ts b/scripts/cli.ts index 98111bcd0b4..79b10eace04 100644 --- a/scripts/cli.ts +++ b/scripts/cli.ts @@ -84,6 +84,7 @@ export async function publishStarterCli( console.log(` update devDependencies["@builder.io/qwik"] = "${version}"`); baseAppPkg.devDependencies['@builder.io/qwik'] = version; + baseAppPkg.devDependencies['eslint-plugin-qwik'] = version; const rootPkg = await readPackageJson(config.rootDir); const typescriptDepVersion = rootPkg.devDependencies!.typescript; diff --git a/starters/apps/base/.eslintignore b/starters/apps/base/.eslintignore new file mode 100644 index 00000000000..b183822b65d --- /dev/null +++ b/starters/apps/base/.eslintignore @@ -0,0 +1,30 @@ +**/*.log +**/.DS_Store +*. +.vscode/settings.json +.history +.yarn +bazel-* +bazel-bin +bazel-out +bazel-qwik +bazel-testlogs +dist +dist-dev +lib +etc +external +node_modules +temp +tsc-out +tsdoc-metadata.json +target +output +rollup.config.js +build +.cache +.vscode +.rollup.cache +dist +tsconfig.tsbuildinfo +vite.config.ts diff --git a/starters/apps/base/.eslintrc.js b/starters/apps/base/.eslintrc.js new file mode 100644 index 00000000000..177ed7e8270 --- /dev/null +++ b/starters/apps/base/.eslintrc.js @@ -0,0 +1,39 @@ +module.exports = { + env: { + browser: true, + es2021: true, + node: true, + }, + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:qwik/recommended', + ], + parser: '@typescript-eslint/parser', + parserOptions: { + tsconfigRootDir: __dirname, + project: ['./tsconfig.json'], + ecmaVersion: 2021, + sourceType: 'module', + ecmaFeatures: { + jsx: true, + }, + }, + plugins: ['@typescript-eslint'], + rules: { + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-inferrable-types': 'off', + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/no-empty-interface': 'off', + '@typescript-eslint/no-namespace': 'off', + '@typescript-eslint/no-empty-function': 'off', + '@typescript-eslint/no-this-alias': 'off', + '@typescript-eslint/ban-types': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + 'prefer-spread': 'off', + 'no-case-declarations': 'off', + 'no-console': 'off', + '@typescript-eslint/no-unused-vars': ['error'], + }, +}; diff --git a/yarn.lock b/yarn.lock index f2e3d71d9e8..9383b435fe0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -413,7 +413,7 @@ __metadata: version: 0.0.0-use.local resolution: "@builder.io/qwik-city@workspace:packages/qwik-city" dependencies: - "@builder.io/qwik": 0.0.27 + "@builder.io/qwik": 0.0.28 "@mdx-js/mdx": ^2.1.1 "@microsoft/api-extractor": 7.24.2 "@types/github-slugger": ^1.3.0 @@ -453,10 +453,10 @@ __metadata: languageName: node linkType: hard -"@builder.io/qwik@npm:0.0.27": - version: 0.0.27 - resolution: "@builder.io/qwik@npm:0.0.27" - checksum: 04a8531a3c837d0f27cad5ea3cfb439c5f6dbb1e542f401147d5cf8c20bab5225f074ac6878a6ccc2eb99a65ea6458b34cdd8f47fa65ff1b85cb7c76c19ca23a +"@builder.io/qwik@npm:0.0.28": + version: 0.0.28 + resolution: "@builder.io/qwik@npm:0.0.28" + checksum: 4ecdfcf70766e4fa9475341e9303322bd58567d15ac729d845c3e82474c170f0486ba5054e7a2ade75761f90b455480b48bf3f1b8380d87fe5d51ccfdbd3ee4f languageName: node linkType: hard @@ -7719,7 +7719,7 @@ __metadata: resolution: "qwik-docs@workspace:packages/docs" dependencies: "@builder.io/partytown": ^0.6.1 - "@builder.io/qwik": 0.0.27 + "@builder.io/qwik": 0.0.28 "@builder.io/qwik-city": 0.0.12 "@cloudflare/kv-asset-handler": 0.2.0 autoprefixer: 10.4.7