From 0910385c873d88ac13ddf4484d6b393ad714f707 Mon Sep 17 00:00:00 2001 From: Masafumi Koba <473530+ybiquitous@users.noreply.github.com> Date: Wed, 1 Dec 2021 23:32:00 +0900 Subject: [PATCH] remove(stylelint): no longer needed `stylelint@14.0.0` has added its type definitions. See below: - https://github.com/stylelint/stylelint/releases/tag/14.0.0 - https://github.com/stylelint/stylelint/pull/5582 --- notNeededPackages.json | 4 + types/stylelint/index.d.ts | 130 -------------------------- types/stylelint/package.json | 7 -- types/stylelint/stylelint-tests.ts | 79 ---------------- types/stylelint/tsconfig.json | 24 ----- types/stylelint/tslint.json | 3 - types/stylelint/v7/index.d.ts | 51 ---------- types/stylelint/v7/stylelint-tests.ts | 24 ----- types/stylelint/v7/tsconfig.json | 29 ------ types/stylelint/v7/tslint.json | 3 - 10 files changed, 4 insertions(+), 350 deletions(-) delete mode 100644 types/stylelint/index.d.ts delete mode 100644 types/stylelint/package.json delete mode 100644 types/stylelint/stylelint-tests.ts delete mode 100644 types/stylelint/tsconfig.json delete mode 100644 types/stylelint/tslint.json delete mode 100644 types/stylelint/v7/index.d.ts delete mode 100644 types/stylelint/v7/stylelint-tests.ts delete mode 100644 types/stylelint/v7/tsconfig.json delete mode 100644 types/stylelint/v7/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 1759a2b5b2473c..13d9e73b02e225 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -4903,6 +4903,10 @@ "libraryName": "styled-jsx", "asOfVersion": "3.4.4" }, + "stylelint": { + "libraryName": "stylelint", + "asOfVersion": "14.0.0" + }, "stylelint-webpack-plugin": { "libraryName": "stylelint-webpack-plugin", "asOfVersion": "2.1.0" diff --git a/types/stylelint/index.d.ts b/types/stylelint/index.d.ts deleted file mode 100644 index 95f47ad7c21542..00000000000000 --- a/types/stylelint/index.d.ts +++ /dev/null @@ -1,130 +0,0 @@ -// Type definitions for stylelint 13.13 -// Project: https://github.com/stylelint/stylelint, https://stylelint.io -// Definitions by: Alan Agius -// Filips Alpe -// James Garbutt -// Bob Matcuk -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.8 - -import { GlobbyOptions } from 'globby'; -import * as postcss from 'postcss'; - -export type FormatterType = 'json' | 'string' | 'verbose' | 'compact' | 'unix' | ((results: LintResult[]) => string); - -export type SyntaxType = 'css-in-js' | 'html' | 'less' | 'markdown' | 'sass' | 'scss' | 'sugarss'; - -export type Severity = 'warning' | 'error'; - -export interface Configuration { - rules: Record; - extends: string | string[]; - plugins: string[]; - processors: string[]; - ignoreFiles: string | string[]; - defaultSeverity: Severity; -} - -export interface LinterOptions { - allowEmptyInput: boolean; - cache: boolean; - cacheLocation: string; - code: string; - codeFilename: string; - config: Partial; - configBasedir: string; - configFile: string; - configOverrides: Partial; - customSyntax: string; - disableDefaultIgnores: boolean; - files: string | string[]; - fix: boolean; - formatter: FormatterType; - globbyOptions: GlobbyOptions; - ignoreDisables: boolean; - ignorePath: string; - maxWarnings: number; - reportDescriptionlessDisables: boolean; - reportInvalidScopeDisables: boolean; - reportNeedlessDisables: boolean; - syntax: SyntaxType; -} - -export interface LinterResult { - errored: boolean; - output: string; - results: LintResult[]; -} - -export interface Warning { - line: number; - column: number; - rule: string; - severity: Severity; - text: string; -} - -export interface LintResult { - source: string; - errored: boolean | undefined; - ignored: boolean | undefined; - warnings: Warning[]; - deprecations: string[]; - invalidOptionWarnings: any[]; -} - -export namespace formatters { - function json(results: LintResult[]): string; - function string(results: LintResult[]): string; - function compact(results: LintResult[]): string; - function verbose(results: LintResult[]): string; - function unix(results: LintResult[]): string; -} - -export function lint(options?: Partial): Promise; - -export type ValidateOptionsAssertion = - | { - actual: any; - possible?: any; - optional?: false; - } - | { - actual?: any; - possible: any; - optional: true; - }; - -export type RuleMessageValue = string | ((...args: any[]) => string); - -export namespace utils { - function report(violation: { - ruleName: string; - result: postcss.Result; - message: string; - node: postcss.Node; - index?: number; - word?: string; - line?: number; - }): void; - - function ruleMessages(ruleName: string, messages: T): T; - - function validateOptions(result: postcss.Result, ruleName: string, ...options: ValidateOptionsAssertion[]): boolean; - - function checkAgainstRule( - options: { - ruleName: string; - ruleSettings: any; - root: any; - }, - callback: (warning: string) => void, - ): void; -} - -export type Plugin = ( - primaryOption: any, - secondaryOptions?: object, -) => (root: postcss.Root, result: postcss.Result) => void | PromiseLike; - -export function createPlugin(ruleName: string, plugin: Plugin): any; diff --git a/types/stylelint/package.json b/types/stylelint/package.json deleted file mode 100644 index 15f60f71ac6aa0..00000000000000 --- a/types/stylelint/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "private": true, - "dependencies": { - "globby": "11.x.x", - "postcss": "7.x.x" - } -} diff --git a/types/stylelint/stylelint-tests.ts b/types/stylelint/stylelint-tests.ts deleted file mode 100644 index 1999e79610ec93..00000000000000 --- a/types/stylelint/stylelint-tests.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { - createPlugin, - FormatterType, - lint, - LinterOptions, - LinterResult, - LintResult, - Plugin, - SyntaxType, - utils, - Warning, -} from 'stylelint'; - -const options: Partial = { - allowEmptyInput: true, - code: 'div { color: red }', - files: ['**/**.scss'], - formatter: 'json', - globbyOptions: { - cwd: './', - }, - cache: true, - cacheLocation: './stylelint.cache.json', - ignoreDisables: true, - reportDescriptionlessDisables: true, - reportInvalidScopeDisables: true, - reportNeedlessDisables: true, - ignorePath: 'foo', - syntax: 'scss', -}; - -lint(options).then((x: LinterResult) => { - const err: boolean = x.errored; - const output: string = x.output; - const results: LintResult[] = x.results; - if (results.length > 0) { - const warnings: Warning[] = results[0].warnings; - } -}); - -const formatter: FormatterType = 'json'; - -const syntax: SyntaxType = 'scss'; - -const ruleName = 'sample-rule'; -const messages = utils.ruleMessages(ruleName, { - violation: 'This a rule violation message', - warning: (reason: string) => `This is not allowed because ${reason}`, -}); - -const testPlugin: Plugin = options => { - return (root, result) => { - const validOptions = utils.validateOptions(result, ruleName, { actual: options }); - if (!validOptions) { - return; - } - - utils.checkAgainstRule( - { - ruleName: 'at-rule-empty-line-before', - ruleSettings: ['always'], - root, - }, - warning => { - utils.report({ - ruleName, - result, - message: messages.warning(warning), - node: root, - index: 1, - word: 'foo', - line: 2, - }); - }, - ); - }; -}; - -createPlugin(ruleName, testPlugin); diff --git a/types/stylelint/tsconfig.json b/types/stylelint/tsconfig.json deleted file mode 100644 index b911f45aec5b93..00000000000000 --- a/types/stylelint/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "stylelint-tests.ts" - ] -} diff --git a/types/stylelint/tslint.json b/types/stylelint/tslint.json deleted file mode 100644 index 2efa283002e7cf..00000000000000 --- a/types/stylelint/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "@definitelytyped/dtslint/dt.json" -} diff --git a/types/stylelint/v7/index.d.ts b/types/stylelint/v7/index.d.ts deleted file mode 100644 index 19d18c20026111..00000000000000 --- a/types/stylelint/v7/index.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Type definitions for stylelint 7.11 -// Project: https://github.com/stylelint/stylelint -// Definitions by: Alan Agius -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export type FormatterType = 'json' | 'string' | 'verbose'; - -export type SyntaxType = 'scss' | 'sass' | 'less' | 'sugarss'; - -export interface LinterOptions { - code?: string | undefined; - codeFilename?: string | undefined; - config?: JSON | undefined; - configBasedir?: string | undefined; - configFile?: string | undefined; - configOverrides?: JSON | undefined; - cache?: boolean | undefined; - cacheLocation?: string | undefined; - files?: string | string[] | undefined; - fix?: boolean | undefined; - formatter?: FormatterType | undefined; - ignoreDisables?: boolean | undefined; - reportNeedlessDisables?: boolean | undefined; - ignorePath?: boolean | undefined; - syntax?: SyntaxType | undefined; - customSyntax?: string | undefined; -} - -export interface LinterResult { - errored: boolean; - output: string; - postcssResults: any[]; - results: LintResult[]; -} - -export interface LintResult { - source: string; - errored: boolean | undefined; - ignored: boolean | undefined; - warnings: string[]; - deprecations: string[]; - invalidOptionWarnings: any[]; -} - -export namespace formatters { - function json(results: LintResult[]): string; - function string(results: LintResult[]): string; - function verbose(results: LintResult[]): string; -} - -export function lint(options?: LinterOptions): Promise; diff --git a/types/stylelint/v7/stylelint-tests.ts b/types/stylelint/v7/stylelint-tests.ts deleted file mode 100644 index 86d03cb78c1aa6..00000000000000 --- a/types/stylelint/v7/stylelint-tests.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { LinterOptions, FormatterType, SyntaxType, lint, LintResult, LinterResult } from 'stylelint'; - -const options: LinterOptions = { - code: 'div { color: red }', - files: ['**/**.scss'], - formatter: 'json', - cache: true, - cacheLocation: './stylelint.cache.json', - ignoreDisables: true, - reportNeedlessDisables: true, - ignorePath: true, - syntax: 'scss', -}; - -lint(options).then((x: LinterResult) => { - const err: boolean = x.errored; - const output: string = x.output; - const postcssResults: any[] = x.postcssResults; - const results: LintResult[] = x.results; -}); - -const formatter: FormatterType = 'json'; - -const syntax: SyntaxType = 'scss'; diff --git a/types/stylelint/v7/tsconfig.json b/types/stylelint/v7/tsconfig.json deleted file mode 100644 index b6f67962527d24..00000000000000 --- a/types/stylelint/v7/tsconfig.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "types": [], - "paths": { - "stylelint": [ - "stylelint/v7" - ] - }, - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "stylelint-tests.ts" - ] -} diff --git a/types/stylelint/v7/tslint.json b/types/stylelint/v7/tslint.json deleted file mode 100644 index 2efa283002e7cf..00000000000000 --- a/types/stylelint/v7/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "@definitelytyped/dtslint/dt.json" -}