1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

lint whole repo (#1600)

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2020-12-02 04:22:10 -05:00 committed by GitHub
parent dcf253e7d5
commit f3f9f08c0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 110 additions and 105 deletions

View File

@ -4,6 +4,7 @@ module.exports = {
ignorePatterns: [ ignorePatterns: [
"**/node_modules/**/*", "**/node_modules/**/*",
"**/dist/**/*", "**/dist/**/*",
"**/static/**/*",
], ],
settings: { settings: {
react: { react: {

View File

@ -1,5 +1,5 @@
{ {
"name": "extension-example", "name": "example-extension",
"version": "1.0.0", "version": "1.0.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,

View File

@ -37,7 +37,7 @@
"download:kubectl": "yarn run ts-node build/download_kubectl.ts", "download:kubectl": "yarn run ts-node build/download_kubectl.ts",
"download:helm": "yarn run ts-node build/download_helm.ts", "download:helm": "yarn run ts-node build/download_helm.ts",
"build:tray-icons": "yarn run ts-node build/build_tray_icon.ts", "build:tray-icons": "yarn run ts-node build/build_tray_icon.ts",
"lint": "yarn run eslint $@ --ext js,ts,tsx --max-warnings=0 src/ integration/ __mocks__/ build/ extensions/", "lint": "yarn run eslint $@ --ext js,ts,tsx --max-warnings=0 .",
"lint:fix": "yarn run lint --fix", "lint:fix": "yarn run lint --fix",
"mkdocs-serve-local": "docker build -t mkdocs-serve-local:latest mkdocs/ && docker run --rm -it -p 8000:8000 -v ${PWD}:/docs mkdocs-serve-local:latest", "mkdocs-serve-local": "docker build -t mkdocs-serve-local:latest mkdocs/ && docker run --rm -it -p 8000:8000 -v ${PWD}:/docs mkdocs-serve-local:latest",
"verify-docs": "docker build -t mkdocs-serve-local:latest mkdocs/ && docker run --rm -v ${PWD}:/docs mkdocs-serve-local:latest build --strict", "verify-docs": "docker build -t mkdocs-serve-local:latest mkdocs/ && docker run --rm -v ${PWD}:/docs mkdocs-serve-local:latest build --strict",

2
types/dom.d.ts vendored
View File

@ -1,4 +1,4 @@
export {} export {};
declare global { declare global {
interface Element { interface Element {

10
types/font-face.d.ts vendored
View File

@ -1,6 +1,6 @@
// https://www.w3.org/TR/css-font-loading/ // https://www.w3.org/TR/css-font-loading/
// https://developer.mozilla.org/en-US/docs/Web/API/FontFace // https://developer.mozilla.org/en-US/docs/Web/API/FontFace
export {} export {};
declare global { declare global {
const FontFace: FontFace; const FontFace: FontFace;
@ -10,11 +10,11 @@ declare global {
} }
type CSSOMString = string; type CSSOMString = string;
type FontFaceLoadStatus = 'unloaded' | 'loading' | 'loaded' | 'error'; type FontFaceLoadStatus = "unloaded" | "loading" | "loaded" | "error";
type FontFaceSetStatus = 'loading' | 'loaded'; type FontFaceSetStatus = "loading" | "loaded";
interface FontFace extends FontFaceDescriptors { class FontFace implements FontFaceDescriptors {
new(family: string, source: string | ArrayBuffer, descriptors?: FontFaceDescriptors): FontFace; constructor(family: string, source: string | ArrayBuffer, descriptors?: FontFaceDescriptors);
readonly status: FontFaceLoadStatus; readonly status: FontFaceLoadStatus;
readonly loaded: Promise<FontFace>; readonly loaded: Promise<FontFace>;
variationSettings: CSSOMString; variationSettings: CSSOMString;

View File

@ -1,18 +1,20 @@
import path from 'path'; import path from "path";
import webpack from "webpack"; import webpack from "webpack";
import { sassCommonVars } from "./src/common/vars"; import { sassCommonVars } from "./src/common/vars";
export default function (): webpack.Configuration { export default function (): webpack.Configuration {
const entry = "./src/extensions/extension-api.ts" const entry = "./src/extensions/extension-api.ts";
const outDir = "./src/extensions/npm/extensions/dist"; const outDir = "./src/extensions/npm/extensions/dist";
return { return {
// Compile for Electron for renderer process // Compile for Electron for renderer process
// see <https://webpack.js.org/configuration/target/> // see <https://webpack.js.org/configuration/target/>
target: "electron-renderer", target: "electron-renderer",
entry, entry,
// this is the default mode, so we should make it explicit to silence the warning
mode: "production",
output: { output: {
filename: 'extension-api.js', filename: "extension-api.js",
// need to be an absolute path // need to be an absolute path
path: path.resolve(__dirname, `${outDir}/src/extensions`), path: path.resolve(__dirname, `${outDir}/src/extensions`),
// can be use in commonjs environments // can be use in commonjs environments
@ -23,7 +25,7 @@ export default function (): webpack.Configuration {
rules: [ rules: [
{ {
test: /\.tsx?$/, test: /\.tsx?$/,
loader: 'ts-loader', loader: "ts-loader",
options: { options: {
// !! ts-loader will use tsconfig.json at folder root // !! ts-loader will use tsconfig.json at folder root
// !! changes in tsconfig.json may have side effects // !! changes in tsconfig.json may have side effects
@ -70,7 +72,7 @@ export default function (): webpack.Configuration {
] ]
}, },
resolve: { resolve: {
extensions: ['.ts', '.tsx', '.js'] extensions: [".ts", ".tsx", ".js"]
}, },
plugins: [ plugins: [
// In ts-loader's README they said to output a built .d.ts file, // In ts-loader's README they said to output a built .d.ts file,

View File

@ -1,12 +1,13 @@
import path from "path"; import path from "path";
import webpack from "webpack"; import webpack from "webpack";
import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin" import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin";
import { isDevelopment, isProduction, mainDir, buildDir } from "./src/common/vars"; import { isDevelopment, isProduction, mainDir, buildDir } from "./src/common/vars";
import nodeExternals from "webpack-node-externals"; import nodeExternals from "webpack-node-externals";
import ProgressBarPlugin from "progress-bar-webpack-plugin"; import ProgressBarPlugin from "progress-bar-webpack-plugin";
import * as vars from "./src/common/vars";
export default function (): webpack.Configuration { export default function (): webpack.Configuration {
console.info('WEBPACK:main', require("./src/common/vars")) console.info("WEBPACK:main", vars);
return { return {
context: __dirname, context: __dirname,
target: "electron-main", target: "electron-main",
@ -21,7 +22,7 @@ export default function (): webpack.Configuration {
path: buildDir, path: buildDir,
}, },
resolve: { resolve: {
extensions: ['.json', '.js', '.ts'] extensions: [".json", ".js", ".ts"]
}, },
externals: [ externals: [
nodeExternals() nodeExternals()
@ -48,5 +49,5 @@ export default function (): webpack.Configuration {
new ProgressBarPlugin(), new ProgressBarPlugin(),
new ForkTsCheckerPlugin(), new ForkTsCheckerPlugin(),
].filter(Boolean) ].filter(Boolean)
} };
} }

View File

@ -4,17 +4,18 @@ import webpack from "webpack";
import HtmlWebpackPlugin from "html-webpack-plugin"; import HtmlWebpackPlugin from "html-webpack-plugin";
import MiniCssExtractPlugin from "mini-css-extract-plugin"; import MiniCssExtractPlugin from "mini-css-extract-plugin";
import TerserPlugin from "terser-webpack-plugin"; import TerserPlugin from "terser-webpack-plugin";
import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin" import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin";
import ProgressBarPlugin from "progress-bar-webpack-plugin"; import ProgressBarPlugin from "progress-bar-webpack-plugin";
import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin' import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin";
import * as vars from "./src/common/vars";
export default [ export default [
webpackLensRenderer webpackLensRenderer
] ];
export function webpackLensRenderer({ showVars = true } = {}): webpack.Configuration { export function webpackLensRenderer({ showVars = true } = {}): webpack.Configuration {
if (showVars) { if (showVars) {
console.info('WEBPACK:renderer', require("./src/common/vars")); console.info("WEBPACK:renderer", vars);
} }
return { return {
context: __dirname, context: __dirname,
@ -27,7 +28,7 @@ export function webpackLensRenderer({ showVars = true } = {}): webpack.Configura
hot: true, hot: true,
// to avoid cors errors when requests is from iframes // to avoid cors errors when requests is from iframes
disableHostCheck: true, disableHostCheck: true,
headers: { 'Access-Control-Allow-Origin': '*' }, headers: { "Access-Control-Allow-Origin": "*" },
}, },
name: "lens-app", name: "lens-app",
mode: isProduction ? "production" : "development", mode: isProduction ? "production" : "development",
@ -39,10 +40,10 @@ export function webpackLensRenderer({ showVars = true } = {}): webpack.Configura
libraryTarget: "global", libraryTarget: "global",
library: "", library: "",
globalObject: "this", globalObject: "this",
publicPath: publicPath, publicPath,
path: buildDir, path: buildDir,
filename: '[name].js', filename: "[name].js",
chunkFilename: 'chunks/[name].js', chunkFilename: "chunks/[name].js",
}, },
stats: { stats: {
warningsFilter: [ warningsFilter: [
@ -51,8 +52,8 @@ export function webpackLensRenderer({ showVars = true } = {}): webpack.Configura
}, },
resolve: { resolve: {
extensions: [ extensions: [
'.js', '.jsx', '.json', ".js", ".jsx", ".json",
'.ts', '.tsx', ".ts", ".tsx",
] ]
}, },
optimization: { optimization: {
@ -91,7 +92,7 @@ export function webpackLensRenderer({ showVars = true } = {}): webpack.Configura
}], }],
], ],
plugins: [ plugins: [
isDevelopment && require.resolve('react-refresh/babel'), isDevelopment && require.resolve("react-refresh/babel"),
].filter(Boolean), ].filter(Boolean),
} }
}, },
@ -190,5 +191,5 @@ export function webpackLensRenderer({ showVars = true } = {}): webpack.Configura
isDevelopment && new ReactRefreshWebpackPlugin(), isDevelopment && new ReactRefreshWebpackPlugin(),
].filter(Boolean), ].filter(Boolean),
} };
} }