chore: lint

This commit is contained in:
liyasthomas
2022-01-05 10:17:23 +05:30
parent dd7aebaf94
commit ffd1acdfae
10 changed files with 50 additions and 48 deletions

View File

@@ -1,12 +1,12 @@
import typescript from "rollup-plugin-ts"
import {lezer} from "@lezer/generator/rollup"
import { lezer } from "@lezer/generator/rollup"
export default {
input: "src/index.js",
external: id => id != "tslib" && !/^(\.?\/|\w:)/.test(id),
external: (id) => id != "tslib" && !/^(\.?\/|\w:)/.test(id),
output: [
{file: "dist/index.cjs", format: "cjs"},
{dir: "./dist", format: "es"}
{ file: "dist/index.cjs", format: "cjs" },
{ dir: "./dist", format: "es" },
],
plugins: [lezer(), typescript()]
plugins: [lezer(), typescript()],
}

View File

@@ -1,22 +1,30 @@
import {parser} from "./syntax.grammar"
import {LRLanguage, LanguageSupport, indentNodeProp, foldNodeProp, foldInside, delimitedIndent} from "@codemirror/language"
import {styleTags, tags as t} from "@codemirror/highlight"
import { parser } from "./syntax.grammar"
import {
LRLanguage,
LanguageSupport,
indentNodeProp,
foldNodeProp,
foldInside,
delimitedIndent,
} from "@codemirror/language"
import { styleTags, tags as t } from "@codemirror/highlight"
export const GQLLanguage = LRLanguage.define({
parser: parser.configure({
props: [
indentNodeProp.add({
"SelectionSet FieldsDefinition ObjectValue SchemaDefinition RootTypeDef": delimitedIndent({ closing: "}", align: true }),
"SelectionSet FieldsDefinition ObjectValue SchemaDefinition RootTypeDef":
delimitedIndent({ closing: "}", align: true }),
}),
foldNodeProp.add({
Application: foldInside,
"SelectionSet FieldsDefinition ObjectValue RootOperationTypeDefinition RootTypeDef": (node) => {
return {
from: node.from,
to: node.to
}
}
"SelectionSet FieldsDefinition ObjectValue RootOperationTypeDefinition RootTypeDef":
(node) => {
return {
from: node.from,
to: node.to,
}
},
}),
styleTags({
Name: t.definition(t.variableName),
@@ -29,13 +37,13 @@ export const GQLLanguage = LRLanguage.define({
NullValue: t.null,
ObjectValue: t.brace,
Comment: t.lineComment,
})
]
}),
],
}),
languageData: {
commentTokens: { line: "#" },
closeBrackets: { brackets: ["(", "[", "{", '"', '"""'] }
}
closeBrackets: { brackets: ["(", "[", "{", '"', '"""'] },
},
})
export function GQL() {

View File

@@ -6,7 +6,7 @@
"newLine": "lf",
"declaration": true,
"moduleResolution": "node",
"allowJs": true,
"allowJs": true
},
"include": ["src/*"]
}
}

View File

@@ -1,13 +1,13 @@
import dts from 'rollup-plugin-dts'
import esbuild from 'rollup-plugin-esbuild'
import multi from '@rollup/plugin-multi-entry'
import dts from "rollup-plugin-dts"
import esbuild from "rollup-plugin-esbuild"
import multi from "@rollup/plugin-multi-entry"
const name = require('./package.json').main.replace(/\.js$/, '')
const name = require("./package.json").main.replace(/\.js$/, "")
const bundle = config => ({
const bundle = (config) => ({
...config,
input: 'src/**/*.ts',
external: id => !/^[./]/.test(id),
input: "src/**/*.ts",
external: (id) => !/^[./]/.test(id),
})
export default [
@@ -16,12 +16,12 @@ export default [
output: [
{
file: `${name}.js`,
format: 'cjs',
format: "cjs",
sourcemap: true,
},
{
file: `${name}.mjs`,
format: 'es',
format: "es",
sourcemap: true,
},
],
@@ -30,7 +30,7 @@ export default [
plugins: [dts()],
output: {
file: `${name}.d.ts`,
format: 'es',
format: "es",
},
}),
]

View File

@@ -38,4 +38,4 @@ export function makeGQLRequest(x: Omit<HoppGQLRequest, "v">) {
v: 1,
...x,
}
}
}

View File

@@ -1,2 +1,2 @@
export * from "./rest"
export * from "./graphql"
export * from "./graphql"

View File

@@ -10,4 +10,4 @@ export const knownContentTypes = {
"text/plain": "plain",
}
export type ValidContentTypes = keyof typeof knownContentTypes
export type ValidContentTypes = keyof typeof knownContentTypes

View File

@@ -9,4 +9,4 @@
"strictNullChecks": true,
"resolveJsonModule": true
}
}
}

View File

@@ -1,8 +1,8 @@
import { Options } from 'tsup'
import { Options } from "tsup"
const options: Options = {
format: [
'cjs',
"cjs",
// loading Babel in ESM is tricky, since Babel itself it CJS only
// we decided to drop ESM support until Babel supports native ESM
// 'esm',
@@ -10,9 +10,7 @@ const options: Options = {
clean: true,
splitting: true,
dts: true,
entryPoints: [
'src/**/*.ts',
],
entryPoints: ["src/**/*.ts"],
}
export default options
export default options

View File

@@ -10,11 +10,7 @@
"~/*": ["./src/*"],
"@/*": ["./src/*"]
},
"types": [
"@types/node",
"@types/jest",
"@relmify/jest-fp-ts"
],
"types": ["@types/node", "@types/jest", "@relmify/jest-fp-ts"],
"outDir": "./lib/",
"rootDir": "./src/",
"declaration": true,
@@ -23,4 +19,4 @@
},
"include": ["./src", "./src/global.d.ts"],
"exclude": ["node_modules", "./src/__tests__", "./src/demo.ts"]
}
}