refactor: lint options

This commit is contained in:
liyasthomas
2021-05-25 21:43:13 +05:30
parent 2e213a8692
commit baf6d6bd29
11 changed files with 174 additions and 96 deletions

View File

@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname $0)/_/husky.sh"
. "$(dirname "$0")/_/husky.sh"
npm run pre-commit

View File

@@ -1,3 +0,0 @@
{
"semi": false
}

3
.prettierrc.js Normal file
View File

@@ -0,0 +1,3 @@
module.exports = {
semi: false
}

View File

@@ -1,224 +1,249 @@
/* fallback */
@font-face {
font-family: 'Material Icons';
font-family: "Material Icons";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url('~assets/fonts/Material_Icons-400-fallback1.woff2') format('woff2');
src: url("~assets/fonts/Material_Icons-400-fallback1.woff2") format("woff2");
}
/* devanagari */
@font-face {
font-family: 'Poppins';
font-family: "Poppins";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url('~assets/fonts/Poppins-400-devanagari2.woff2') format('woff2');
unicode-range: U+0900-097F, U+1CD0-1CF6, U+1CF8-1CF9, U+200C-200D, U+20A8, U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FB;
src: url("~assets/fonts/Poppins-400-devanagari2.woff2") format("woff2");
unicode-range: U+0900-097F, U+1CD0-1CF6, U+1CF8-1CF9, U+200C-200D, U+20A8,
U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FB;
}
/* latin-ext */
@font-face {
font-family: 'Poppins';
font-family: "Poppins";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url('~assets/fonts/Poppins-400-latin-ext3.woff2') format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
src: url("~assets/fonts/Poppins-400-latin-ext3.woff2") format("woff2");
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Poppins';
font-family: "Poppins";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url('~assets/fonts/Poppins-400-latin4.woff2') format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
src: url("~assets/fonts/Poppins-400-latin4.woff2") format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
U+FEFF, U+FFFD;
}
/* devanagari */
@font-face {
font-family: 'Poppins';
font-family: "Poppins";
font-style: normal;
font-weight: 500;
font-display: swap;
src: url('~assets/fonts/Poppins-500-devanagari5.woff2') format('woff2');
unicode-range: U+0900-097F, U+1CD0-1CF6, U+1CF8-1CF9, U+200C-200D, U+20A8, U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FB;
src: url("~assets/fonts/Poppins-500-devanagari5.woff2") format("woff2");
unicode-range: U+0900-097F, U+1CD0-1CF6, U+1CF8-1CF9, U+200C-200D, U+20A8,
U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FB;
}
/* latin-ext */
@font-face {
font-family: 'Poppins';
font-family: "Poppins";
font-style: normal;
font-weight: 500;
font-display: swap;
src: url('~assets/fonts/Poppins-500-latin-ext6.woff2') format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
src: url("~assets/fonts/Poppins-500-latin-ext6.woff2") format("woff2");
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Poppins';
font-family: "Poppins";
font-style: normal;
font-weight: 500;
font-display: swap;
src: url('~assets/fonts/Poppins-500-latin7.woff2') format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
src: url("~assets/fonts/Poppins-500-latin7.woff2") format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
U+FEFF, U+FFFD;
}
/* devanagari */
@font-face {
font-family: 'Poppins';
font-family: "Poppins";
font-style: normal;
font-weight: 600;
font-display: swap;
src: url('~assets/fonts/Poppins-600-devanagari8.woff2') format('woff2');
unicode-range: U+0900-097F, U+1CD0-1CF6, U+1CF8-1CF9, U+200C-200D, U+20A8, U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FB;
src: url("~assets/fonts/Poppins-600-devanagari8.woff2") format("woff2");
unicode-range: U+0900-097F, U+1CD0-1CF6, U+1CF8-1CF9, U+200C-200D, U+20A8,
U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FB;
}
/* latin-ext */
@font-face {
font-family: 'Poppins';
font-family: "Poppins";
font-style: normal;
font-weight: 600;
font-display: swap;
src: url('~assets/fonts/Poppins-600-latin-ext9.woff2') format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
src: url("~assets/fonts/Poppins-600-latin-ext9.woff2") format("woff2");
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Poppins';
font-family: "Poppins";
font-style: normal;
font-weight: 600;
font-display: swap;
src: url('~assets/fonts/Poppins-600-latin10.woff2') format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
src: url("~assets/fonts/Poppins-600-latin10.woff2") format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
U+FEFF, U+FFFD;
}
/* devanagari */
@font-face {
font-family: 'Poppins';
font-family: "Poppins";
font-style: normal;
font-weight: 700;
font-display: swap;
src: url('~assets/fonts/Poppins-700-devanagari11.woff2') format('woff2');
unicode-range: U+0900-097F, U+1CD0-1CF6, U+1CF8-1CF9, U+200C-200D, U+20A8, U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FB;
src: url("~assets/fonts/Poppins-700-devanagari11.woff2") format("woff2");
unicode-range: U+0900-097F, U+1CD0-1CF6, U+1CF8-1CF9, U+200C-200D, U+20A8,
U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FB;
}
/* latin-ext */
@font-face {
font-family: 'Poppins';
font-family: "Poppins";
font-style: normal;
font-weight: 700;
font-display: swap;
src: url('~assets/fonts/Poppins-700-latin-ext12.woff2') format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
src: url("~assets/fonts/Poppins-700-latin-ext12.woff2") format("woff2");
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Poppins';
font-family: "Poppins";
font-style: normal;
font-weight: 700;
font-display: swap;
src: url('~assets/fonts/Poppins-700-latin13.woff2') format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
src: url("~assets/fonts/Poppins-700-latin13.woff2") format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
U+FEFF, U+FFFD;
}
/* devanagari */
@font-face {
font-family: 'Poppins';
font-family: "Poppins";
font-style: normal;
font-weight: 800;
font-display: swap;
src: url('~assets/fonts/Poppins-800-devanagari14.woff2') format('woff2');
unicode-range: U+0900-097F, U+1CD0-1CF6, U+1CF8-1CF9, U+200C-200D, U+20A8, U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FB;
src: url("~assets/fonts/Poppins-800-devanagari14.woff2") format("woff2");
unicode-range: U+0900-097F, U+1CD0-1CF6, U+1CF8-1CF9, U+200C-200D, U+20A8,
U+20B9, U+25CC, U+A830-A839, U+A8E0-A8FB;
}
/* latin-ext */
@font-face {
font-family: 'Poppins';
font-family: "Poppins";
font-style: normal;
font-weight: 800;
font-display: swap;
src: url('~assets/fonts/Poppins-800-latin-ext15.woff2') format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
src: url("~assets/fonts/Poppins-800-latin-ext15.woff2") format("woff2");
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Poppins';
font-family: "Poppins";
font-style: normal;
font-weight: 800;
font-display: swap;
src: url('~assets/fonts/Poppins-800-latin16.woff2') format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
src: url("~assets/fonts/Poppins-800-latin16.woff2") format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
font-family: 'Roboto Mono';
font-family: "Roboto Mono";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url('~assets/fonts/Roboto_Mono-400-cyrillic-ext17.woff2') format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
src: url("~assets/fonts/Roboto_Mono-400-cyrillic-ext17.woff2") format("woff2");
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F,
U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'Roboto Mono';
font-family: "Roboto Mono";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url('~assets/fonts/Roboto_Mono-400-cyrillic18.woff2') format('woff2');
src: url("~assets/fonts/Roboto_Mono-400-cyrillic18.woff2") format("woff2");
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek */
@font-face {
font-family: 'Roboto Mono';
font-family: "Roboto Mono";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url('~assets/fonts/Roboto_Mono-400-greek19.woff2') format('woff2');
src: url("~assets/fonts/Roboto_Mono-400-greek19.woff2") format("woff2");
unicode-range: U+0370-03FF;
}
/* vietnamese */
@font-face {
font-family: 'Roboto Mono';
font-family: "Roboto Mono";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url('~assets/fonts/Roboto_Mono-400-vietnamese20.woff2') format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
src: url("~assets/fonts/Roboto_Mono-400-vietnamese20.woff2") format("woff2");
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1,
U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Roboto Mono';
font-family: "Roboto Mono";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url('~assets/fonts/Roboto_Mono-400-latin-ext21.woff2') format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
src: url("~assets/fonts/Roboto_Mono-400-latin-ext21.woff2") format("woff2");
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Roboto Mono';
font-family: "Roboto Mono";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url('~assets/fonts/Roboto_Mono-400-latin22.woff2') format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
src: url("~assets/fonts/Roboto_Mono-400-latin22.woff2") format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
U+FEFF, U+FFFD;
}
.material-icons {
font-family: 'Material Icons';
font-family: "Material Icons"; /* stylelint-disable-line font-family-no-missing-generic-family-keyword */
font-weight: normal;
font-style: normal;
font-size: 24px;
@@ -229,6 +254,6 @@
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-webkit-font-feature-settings: 'liga';
-webkit-font-feature-settings: "liga";
-webkit-font-smoothing: antialiased;
}

View File

@@ -1,5 +1,6 @@
/* purgecss start ignore */
@tailwind base;
@tailwind components;
/* purgecss end ignore */
@tailwind utilities;

View File

@@ -99,7 +99,7 @@ import {
toggleGraphqlHistoryEntryStar,
toggleRESTHistoryEntryStar,
deleteGraphqlHistoryEntry,
deleteRESTHistoryEntry
deleteRESTHistoryEntry,
} from "~/newstore/history"
export default {
@@ -116,7 +116,7 @@ export default {
},
subscriptions() {
return {
history: this.page === "rest" ? restHistory$ : graphqlHistory$
history: this.page === "rest" ? restHistory$ : graphqlHistory$,
}
},
computed: {

View File

@@ -36,6 +36,7 @@ const axiosWithProxy = async (req) => {
} catch (e) {
// Check if the throw is due to a cancellation
if (axios.isCancel(e)) {
// eslint-disable-next-line no-throw-literal
throw "cancellation"
} else {
throw e
@@ -54,6 +55,7 @@ const axiosWithoutProxy = async (req, _store) => {
return res
} catch (e) {
if (axios.isCancel(e)) {
// eslint-disable-next-line no-throw-literal
throw "cancellation"
} else {
throw e

View File

@@ -1,3 +1,5 @@
/* eslint-disable */
import infer from "tern/lib/infer"
import tern from "tern/lib/tern"
@@ -69,7 +71,8 @@ function makeVisitors(server, query, file, messages) {
var expr = tern.findQueryExpr(file, query)
var type = infer.expressionType(expr)
var objExpr = type.getType()
if (objExpr && objExpr.originNode) return getNodeValue(objExpr.originNode)
if (objExpr && objExpr.originNode)
return getNodeValue(objExpr.originNode)
return null
}
return node.value
@@ -146,7 +149,8 @@ function makeVisitors(server, query, file, messages) {
if (!expectedType || !actualType) return true
var currentProto = actualType.proto
while (currentProto) {
if (expectedType.proto && expectedType.proto.name === currentProto.name) return true
if (expectedType.proto && expectedType.proto.name === currentProto.name)
return true
currentProto = currentProto.proto
}
return false
@@ -283,7 +287,10 @@ function makeVisitors(server, query, file, messages) {
}
}
} else {
var actualArg = infer.expressionType({ node: actualNode, state: state })
var actualArg = infer.expressionType({
node: actualNode,
state: state,
})
// if actual type is an Object literal and expected type is an object, we ignore
// the comparison type since object literal properties validation is done inside "ObjectExpression".
if (!(expectedArg.getObjType() && isObjectLiteral(actualArg))) {
@@ -328,7 +335,11 @@ function makeVisitors(server, query, file, messages) {
function isUsedVariable(varNode, varState, file, srv) {
var name = varNode.name
for (var scope = varState; scope && !(name in scope.props); scope = scope.prev) {}
for (
var scope = varState;
scope && !(name in scope.props);
scope = scope.prev
) {}
if (!scope) return false
var hasRef = false
@@ -350,7 +361,8 @@ function makeVisitors(server, query, file, messages) {
infer.findRefs(file.ast, file.scope, name, scope, searchRef(file))
for (var i = 0; i < srv.files.length && !hasRef; ++i) {
var cur = srv.files[i]
if (cur != file) infer.findRefs(cur.ast, cur.scope, name, scope, searchRef(cur))
if (cur != file)
infer.findRefs(cur.ast, cur.scope, name, scope, searchRef(cur))
}
}
} catch (e) {}
@@ -374,14 +386,18 @@ function makeVisitors(server, query, file, messages) {
unusedRule.severity
)
// type mismatch?
if (mismatchRule) validateAssignement(varNode, decl.init, mismatchRule, state)
if (mismatchRule)
validateAssignement(varNode, decl.init, mismatchRule, state)
}
}
break
case "FunctionDeclaration":
if (unusedRule) {
var varNode = node.id
if (varNode.name != "✖" && !isUsedVariable(varNode, state, file, server))
if (
varNode.name != "✖" &&
!isUsedVariable(varNode, state, file, server)
)
addMessage(
varNode,
"Unused function '" + getNodeName(varNode) + "'",
@@ -410,7 +426,10 @@ function makeVisitors(server, query, file, messages) {
var rule = getRule("MixedReturnTypes")
if (!rule) return
if (state.fnType && state.fnType.retval) {
var actualType = infer.expressionType({ node: node.argument, state: state }),
var actualType = infer.expressionType({
node: node.argument,
state: state,
}),
expectedType = state.fnType.retval
if (!compareType(expectedType, actualType)) {
addMessage(
@@ -458,14 +477,21 @@ function makeVisitors(server, query, file, messages) {
// this may contain properties that are not really defined.
parentType.types.forEach(function (potentialType) {
// Obj#hasProp checks the prototype as well
if (typeof potentialType.hasProp == "function" && potentialType.hasProp(prop, true)) {
if (
typeof potentialType.hasProp == "function" &&
potentialType.hasProp(prop, true)
) {
propertyDefined = true
}
})
}
if (!propertyDefined) {
addMessage(node, "Unknown property '" + getNodeName(node) + "'", rule.severity)
addMessage(
node,
"Unknown property '" + getNodeName(node) + "'",
rule.severity
)
}
}
},
@@ -482,7 +508,11 @@ function makeVisitors(server, query, file, messages) {
} else if (type.isEmpty()) {
// The type of the identifier cannot be determined,
// and the origin is unknown.
addMessage(node, "Unknown identifier '" + getNodeName(node) + "'", rule.severity)
addMessage(
node,
"Unknown identifier '" + getNodeName(node) + "'",
rule.severity
)
} else {
// Even though the origin node is unknown, the type is known.
// This is typically the case for built-in identifiers (e.g. window or document).
@@ -502,7 +532,10 @@ function makeVisitors(server, query, file, messages) {
var rule = getRule("ObjectLiteral")
if (!rule) return
var actualType = node.objType
var ctxType = infer.typeFromContext(file.ast, { node: node, state: state }),
var ctxType = infer.typeFromContext(file.ast, {
node: node,
state: state,
}),
expectedType = null
if (ctxType instanceof infer.Obj) {
expectedType = ctxType.getObjType()
@@ -522,7 +555,10 @@ function makeVisitors(server, query, file, messages) {
var rule = getRule("Array")
if (!rule) return
//var actualType = infer.expressionType({node: node, state: state});
var ctxType = infer.typeFromContext(file.ast, { node: node, state: state }),
var ctxType = infer.typeFromContext(file.ast, {
node: node,
state: state,
}),
expectedType = getArrType(ctxType)
if (expectedType /*&& expectedType != actualType*/) {
// expected type is known. Ex: config object of RequireJS
@@ -540,7 +576,11 @@ function makeVisitors(server, query, file, messages) {
// Validate ES6 modules "from"
var modType = me.getModType(source)
if (!modType) {
addMessage(source, "Invalid modules from '" + source.value + "'", rule.severity)
addMessage(
source,
"Invalid modules from '" + source.value + "'",
rule.severity
)
return
}
// Validate ES6 modules "specifiers"
@@ -636,7 +676,8 @@ export function validateFiles(server, query) {
state = file.scope
var visitors = makeVisitors(server, query, file, messagesFile)
walk.simple(ast, visitors, infer.searchVisitor, state)
if (groupByFiles) messages.push({ file: file.name, messages: messagesFile })
if (groupByFiles)
messages.push({ file: file.name, messages: messagesFile })
}
return { messages: messages }
} catch (err) {
@@ -655,8 +696,14 @@ var getLint = (tern.getLint = function (name) {
function getRules(options) {
var rules = {}
for (var ruleName in defaultRules) {
if (options && options.rules && options.rules[ruleName] && options.rules[ruleName].severity) {
if (options.rules[ruleName].severity != "none") rules[ruleName] = options.rules[ruleName]
if (
options &&
options.rules &&
options.rules[ruleName] &&
options.rules[ruleName].severity
) {
if (options.rules[ruleName].severity != "none")
rules[ruleName] = options.rules[ruleName]
} else {
rules[ruleName] = defaultRules[ruleName]
}
@@ -667,6 +714,9 @@ function getRules(options) {
function getRule(ruleName) {
const cx = infer.cx()
const server = cx.parent
const rules = server && server._lint && server._lint.rules ? server._lint.rules : defaultRules
const rules =
server && server._lint && server._lint.rules
? server._lint.rules
: defaultRules
return rules[ruleName]
}

View File

@@ -10,17 +10,17 @@
"start": "nuxt start",
"generate": "nuxt generate --modern",
"analyze": "npx nuxt build -a",
"lint:js": "eslint --ext .ts,.js,.vue --ignore-path .gitignore .",
"lint:style": "stylelint **/*.{vue,css} --ignore-path .gitignore",
"lint": "npm run lint:js && npm run lint:style",
"lint:script": "eslint --ext .ts,.js,.vue --ignore-path .gitignore .",
"lint:style": "stylelint **/*.{css,scss,vue} --ignore-path .gitignore",
"lint": "npm run lint:script && npm run lint:style",
"lintfix": "eslint --ext .ts,.js,.vue --ignore-path .gitignore . --fix",
"test": "jest",
"postinstall": "husky install",
"prepare": "husky install",
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.{ts,js,vue}": "eslint",
"*.{css,vue}": "stylelint"
"*.{css,scss,vue}": "stylelint"
},
"dependencies": {
"@apollo/client": "^3.3.19",