update lint setting names

master
Brad Cornes 2020-06-16 16:29:08 +01:00
parent bb3605c9ad
commit f4507eea46
4 changed files with 30 additions and 34 deletions

View File

@ -87,7 +87,7 @@
"markdownDescription": "", "markdownDescription": "",
"scope": "language-overridable" "scope": "language-overridable"
}, },
"tailwindCSS.lint.unsupportedApply": { "tailwindCSS.lint.invalidApply": {
"type": "string", "type": "string",
"enum": [ "enum": [
"ignore", "ignore",
@ -98,7 +98,7 @@
"markdownDescription": "", "markdownDescription": "",
"scope": "language-overridable" "scope": "language-overridable"
}, },
"tailwindCSS.lint.unknownScreen": { "tailwindCSS.lint.invalidScreen": {
"type": "string", "type": "string",
"enum": [ "enum": [
"ignore", "ignore",
@ -109,7 +109,7 @@
"markdownDescription": "", "markdownDescription": "",
"scope": "language-overridable" "scope": "language-overridable"
}, },
"tailwindCSS.lint.unknownVariant": { "tailwindCSS.lint.invalidVariant": {
"type": "string", "type": "string",
"enum": [ "enum": [
"ignore", "ignore",
@ -120,7 +120,7 @@
"markdownDescription": "", "markdownDescription": "",
"scope": "language-overridable" "scope": "language-overridable"
}, },
"tailwindCSS.lint.invalidHelperKey": { "tailwindCSS.lint.invalidConfigPath": {
"type": "string", "type": "string",
"enum": [ "enum": [
"ignore", "ignore",
@ -131,7 +131,7 @@
"markdownDescription": "", "markdownDescription": "",
"scope": "language-overridable" "scope": "language-overridable"
}, },
"tailwindCSS.lint.unsupportedTailwindDirective": { "tailwindCSS.lint.invalidTailwindDirective": {
"type": "string", "type": "string",
"enum": [ "enum": [
"ignore", "ignore",

View File

@ -25,12 +25,12 @@ import { isObject } from '../../class-names/isObject'
import { stringToPath } from '../util/stringToPath' import { stringToPath } from '../util/stringToPath'
import { closest } from '../util/closest' import { closest } from '../util/closest'
function getUnsupportedApplyDiagnostics( function getInvalidApplyDiagnostics(
state: State, state: State,
document: TextDocument, document: TextDocument,
settings: Settings settings: Settings
): Diagnostic[] { ): Diagnostic[] {
let severity = settings.lint.unsupportedApply let severity = settings.lint.invalidApply
if (severity === 'ignore') return [] if (severity === 'ignore') return []
const classNames = findClassNamesInRange(document, undefined, 'css') const classNames = findClassNamesInRange(document, undefined, 'css')
@ -138,12 +138,12 @@ function getUtilityConflictDiagnostics(
return diagnostics return diagnostics
} }
function getUnknownScreenDiagnostics( function getInvalidScreenDiagnostics(
state: State, state: State,
document: TextDocument, document: TextDocument,
settings: Settings settings: Settings
): Diagnostic[] { ): Diagnostic[] {
let severity = settings.lint.unknownScreen let severity = settings.lint.invalidScreen
if (severity === 'ignore') return [] if (severity === 'ignore') return []
let diagnostics: Diagnostic[] = [] let diagnostics: Diagnostic[] = []
@ -199,12 +199,12 @@ function getUnknownScreenDiagnostics(
return diagnostics return diagnostics
} }
function getUnknownVariantDiagnostics( function getInvalidVariantDiagnostics(
state: State, state: State,
document: TextDocument, document: TextDocument,
settings: Settings settings: Settings
): Diagnostic[] { ): Diagnostic[] {
let severity = settings.lint.unknownVariant let severity = settings.lint.invalidVariant
if (severity === 'ignore') return [] if (severity === 'ignore') return []
let diagnostics: Diagnostic[] = [] let diagnostics: Diagnostic[] = []
@ -263,12 +263,12 @@ function getUnknownVariantDiagnostics(
return diagnostics return diagnostics
} }
function getInvalidHelperKeyDiagnostics( function getInvalidConfigPathDiagnostics(
state: State, state: State,
document: TextDocument, document: TextDocument,
settings: Settings settings: Settings
): Diagnostic[] { ): Diagnostic[] {
let severity = settings.lint.invalidHelperKey let severity = settings.lint.invalidConfigPath
if (severity === 'ignore') return [] if (severity === 'ignore') return []
let diagnostics: Diagnostic[] = [] let diagnostics: Diagnostic[] = []
@ -396,12 +396,12 @@ function getInvalidHelperKeyDiagnostics(
return diagnostics return diagnostics
} }
function getUnsupportedTailwindDirectiveDiagnostics( function getInvalidTailwindDirectiveDiagnostics(
state: State, state: State,
document: TextDocument, document: TextDocument,
settings: Settings settings: Settings
): Diagnostic[] { ): Diagnostic[] {
let severity = settings.lint.unsupportedTailwindDirective let severity = settings.lint.invalidTailwindDirective
if (severity === 'ignore') return [] if (severity === 'ignore') return []
let diagnostics: Diagnostic[] = [] let diagnostics: Diagnostic[] = []
@ -473,15 +473,11 @@ export async function provideDiagnostics(
const diagnostics: Diagnostic[] = settings.validate const diagnostics: Diagnostic[] = settings.validate
? [ ? [
...getUtilityConflictDiagnostics(state, document, settings), ...getUtilityConflictDiagnostics(state, document, settings),
...getUnsupportedApplyDiagnostics(state, document, settings), ...getInvalidApplyDiagnostics(state, document, settings),
...getUnknownScreenDiagnostics(state, document, settings), ...getInvalidScreenDiagnostics(state, document, settings),
...getUnknownVariantDiagnostics(state, document, settings), ...getInvalidVariantDiagnostics(state, document, settings),
...getInvalidHelperKeyDiagnostics(state, document, settings), ...getInvalidConfigPathDiagnostics(state, document, settings),
...getUnsupportedTailwindDirectiveDiagnostics( ...getInvalidTailwindDirectiveDiagnostics(state, document, settings),
state,
document,
settings
),
] ]
: [] : []

View File

@ -44,11 +44,11 @@ const defaultSettings: Settings = {
validate: true, validate: true,
lint: { lint: {
utilityConflicts: 'warning', utilityConflicts: 'warning',
unsupportedApply: 'error', invalidApply: 'error',
unknownScreen: 'error', invalidScreen: 'error',
unknownVariant: 'error', invalidVariant: 'error',
invalidHelperKey: 'error', invalidConfigPath: 'error',
unsupportedTailwindDirective: 'error', invalidTailwindDirective: 'error',
}, },
} }
let globalSettings: Settings = defaultSettings let globalSettings: Settings = defaultSettings

View File

@ -34,11 +34,11 @@ export type Settings = {
validate: boolean validate: boolean
lint: { lint: {
utilityConflicts: DiagnosticSeveritySetting utilityConflicts: DiagnosticSeveritySetting
unsupportedApply: DiagnosticSeveritySetting invalidApply: DiagnosticSeveritySetting
unknownScreen: DiagnosticSeveritySetting invalidScreen: DiagnosticSeveritySetting
unknownVariant: DiagnosticSeveritySetting invalidVariant: DiagnosticSeveritySetting
invalidHelperKey: DiagnosticSeveritySetting invalidConfigPath: DiagnosticSeveritySetting
unsupportedTailwindDirective: DiagnosticSeveritySetting invalidTailwindDirective: DiagnosticSeveritySetting
} }
} }