Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@blueprintjs/eslint-plugin

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blueprintjs/eslint-plugin - npm Package Compare versions

Comparing version 2.7.8 to 3.0.0-alpha.1

2

lib/index.js

@@ -20,3 +20,3 @@ "use strict";

/**
* Enable all Blueprint-specific lint rules defined in this package.
* Enables all Blueprint-specific lint rules defined in this package.
*/

@@ -23,0 +23,0 @@ module.exports = {

@@ -25,4 +25,4 @@ "use strict";

// find all pt- prefixed classes, except those that begin with pt-icon (handled by other rules).
// currently support "pt-", "bp3-", "bp4-" prefixes.
const BLUEPRINT_CLASSNAME_PATTERN = /(?<![\w])((?:pt|bp3|bp4)-(?!icon)[\w-]+)/g;
// currently supports "pt-", "bp3-", "bp4-", "bp5-" prefixes.
const BLUEPRINT_CLASSNAME_PATTERN = /(?<![\w])((?:pt|bp3|bp4|bp5)-(?!icon)[\w-]+)/g;
// tslint:disable object-literal-sort-keys

@@ -151,3 +151,3 @@ exports.classesConstantsRule = (0, createRule_1.createRule)({

const className = text
.replace(/(pt|bp3|bp4)-/, "")
.replace(/(pt|bp3|bp4|bp5)-/, "")
.replace(/-/g, "_")

@@ -154,0 +154,0 @@ .toUpperCase();

@@ -10,5 +10,4 @@ declare const _default: {

"no-deprecated-table-components": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"migration" | "migrationWithPropUsage", unknown[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
"no-deprecated-timezone-components": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"migration" | "migrationWithPropUsage", unknown[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
"no-deprecated-type-references": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"migration", [], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
};
export default _default;

@@ -33,5 +33,4 @@ "use strict";

"no-deprecated-table-components": no_deprecated_components_1.noDeprecatedTableComponentsRule,
"no-deprecated-timezone-components": no_deprecated_components_1.noDeprecatedTimezoneComponentsRule,
"no-deprecated-type-references": no_deprecated_type_references_1.noDeprecatedTypeReferencesRule,
};
//# sourceMappingURL=index.js.map

@@ -6,2 +6,1 @@ export * from "./no-deprecated-components";

export * from "./no-deprecated-table-components";
export * from "./no-deprecated-timezone-components";

@@ -12,3 +12,2 @@ "use strict";

tslib_1.__exportStar(require("./no-deprecated-table-components"), exports);
tslib_1.__exportStar(require("./no-deprecated-timezone-components"), exports);
//# sourceMappingURL=index.js.map

@@ -12,3 +12,2 @@ "use strict";

const no_deprecated_table_components_1 = require("./no-deprecated-table-components");
const no_deprecated_timezone_components_1 = require("./no-deprecated-timezone-components");
/**

@@ -20,9 +19,3 @@ * This rule checks a hardcoded list of components that Blueprint is actively migrating to a newer version (e.g. v1 -> v2)

*/
exports.noDeprecatedComponentsRule = (0, createNoDeprecatedComponentsRule_1.createNoDeprecatedComponentsRule)("no-deprecated-components", [
"@blueprintjs/core",
"@blueprintjs/datetime",
"@blueprintjs/select",
"@blueprintjs/table",
"@blueprintjs/timezone",
], Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, no_deprecated_core_components_1.coreComponentsMigrationMapping), no_deprecated_datetime_components_1.datetimeComponentsMigrationMapping), no_deprecated_select_components_1.selectComponentsMigrationMapping), no_deprecated_table_components_1.tableComponentsMigrationMapping), no_deprecated_timezone_components_1.timezoneComponentsMigrationMapping));
exports.noDeprecatedComponentsRule = (0, createNoDeprecatedComponentsRule_1.createNoDeprecatedComponentsRule)("no-deprecated-components", ["@blueprintjs/core", "@blueprintjs/datetime", "@blueprintjs/select", "@blueprintjs/table"], Object.assign(Object.assign(Object.assign(Object.assign({}, no_deprecated_core_components_1.coreComponentsMigrationMapping), no_deprecated_datetime_components_1.datetimeComponentsMigrationMapping), no_deprecated_select_components_1.selectComponentsMigrationMapping), no_deprecated_table_components_1.tableComponentsMigrationMapping));
//# sourceMappingURL=no-deprecated-components.js.map

@@ -1,10 +0,2 @@

export declare const coreComponentsMigrationMapping: {
AbstractComponent: string;
AbstractPureComponent: string;
Breadcrumbs: string;
CollapsibleList: string;
"MenuItem.popoverProps": string;
Popover: string;
Tooltip: string;
};
export declare const coreComponentsMigrationMapping: {};
/**

@@ -11,0 +3,0 @@ * This rule is similar to "@blueprintjs/no-deprecated-components", but it only checks for usage

@@ -9,11 +9,4 @@ "use strict";

exports.coreComponentsMigrationMapping = {
AbstractComponent: "AbstractComponent2",
AbstractPureComponent: "AbstractPureComponent2",
Breadcrumbs: "Breadcrumbs2",
CollapsibleList: "OverflowList",
"MenuItem.popoverProps": "MenuItem2",
// TODO(@adidahiya): Blueprint v6
// PanelStack: "PanelStack2",
Popover: "Popover2",
Tooltip: "Tooltip2",
// TODO(@adidahiya): Blueprint v6
// PanelStack: "PanelStack2",
};

@@ -20,0 +13,0 @@ /**

@@ -1,5 +0,2 @@

export declare const datetimeComponentsMigrationMapping: {
DateInput: string;
DateRangeInput: string;
};
export declare const datetimeComponentsMigrationMapping: {};
/**

@@ -6,0 +3,0 @@ * This rule is similar to "@blueprintjs/no-deprecated-components", but it only checks for usage

@@ -9,6 +9,4 @@ "use strict";

exports.datetimeComponentsMigrationMapping = {
DateInput: "DateInput2",
DateRangeInput: "DateRangeInput2",
// TODO(@adidahiya): Blueprint v6
// DateTimePicker: "DatePicker",
// TODO(@adidahiya): Blueprint v6
// DateTimePicker: "DatePicker",
};

@@ -15,0 +13,0 @@ /**

@@ -1,6 +0,2 @@

export declare const selectComponentsMigrationMapping: {
MultiSelect: string;
Select: string;
Suggest: string;
};
export declare const selectComponentsMigrationMapping: {};
/**

@@ -7,0 +3,0 @@ * This rule is similar to "@blueprintjs/no-deprecated-components", but it only checks for usage

@@ -9,5 +9,3 @@ "use strict";

exports.selectComponentsMigrationMapping = {
MultiSelect: "MultiSelect2",
Select: "Select2",
Suggest: "Suggest2",
// nothing, for now
};

@@ -14,0 +12,0 @@ /**

@@ -1,5 +0,2 @@

export declare const tableComponentsMigrationMapping: {
JSONFormat: string;
TruncatedFormat: string;
};
export declare const tableComponentsMigrationMapping: {};
/**

@@ -6,0 +3,0 @@ * This rule is similar to "@blueprintjs/no-deprecated-components", but it only checks for usage

@@ -9,9 +9,5 @@ "use strict";

exports.tableComponentsMigrationMapping = {
JSONFormat: "JSONFormat2",
TruncatedFormat: "TruncatedFormat2",
// TODO(@adidahiya): Blueprint v6
// ColumnHeaderCell: "ColumnHeaderCell2",
// EditableCell: "EditableCell2",
// RowHeaderCell: "RowHeaderCell2",
// Table: "Table2",
// TODO(@adidahiya): Blueprint v6
// EditableCell: "EditableCell2",
// Table: "Table2",
};

@@ -18,0 +14,0 @@ /**

@@ -140,3 +140,2 @@ "use strict";

],
"@blueprintjs/timezone": ["ITimezoneItem", "ITimezonePickerProps"],
};

@@ -143,0 +142,0 @@ /**

{
"name": "@blueprintjs/eslint-plugin",
"version": "2.7.8",
"version": "3.0.0-alpha.1",
"description": "ESLint rules for use with @blueprintjs packages",

@@ -19,3 +19,3 @@ "main": "lib/index.js",

"devDependencies": {
"@blueprintjs/node-build-scripts": "^7.1.1",
"@blueprintjs/node-build-scripts": "^8.0.0-alpha.1",
"@types/dedent": "~0.7.0",

@@ -22,0 +22,0 @@ "dedent": "^0.7.0",

@@ -60,3 +60,3 @@ <img height="204" src="https://cloud.githubusercontent.com/assets/464822/20228152/d3f36dc2-a804-11e6-80ff-51ada2d13ea7.png">

Enforce usage of class names exported as public API via the `Classes` object instead of string literals like `"bp4-dark"`.
Enforce usage of class names exported as public API via the `Classes` object instead of string literals like `"bp5-dark"`.

@@ -66,3 +66,3 @@ Each `@blueprintjs` package exports a `Classes` object which contains constants for every CSS class defined by the package.

__Rationale__: This is useful to avoid typos in styling or creating Blueprint components, and also helps future-proof your code for major
version bumps of Blueprint where the class namespace (e.g. `bp4-`) changes.
version bumps of Blueprint where the class namespace (e.g. `bp5-`) changes.

@@ -213,12 +213,2 @@ ```json

### `@blueprintjs/no-deprecated-timezone-components`
Similar to `@blueprintjs/no-deprecated-components`, but only flags usage of deprecated components from the
`@blueprintjs/core` package instead of all `@blueprintjs/` packages.
__Rationale__: In migrations of large code bases, it may be useful to apply more granular rule configuration of
"no-deprecated-components" to make incremental progress towards the newer APIs. This allows you, for example, to flag
deprecated `@blueprintjs/timezone` component usage as errors while allowing deprecated components from other packages
to pass as lint warnings.
### `@blueprintjs/no-deprecated-type-references`

@@ -225,0 +215,0 @@

@@ -19,3 +19,3 @@ /*

/**
* Enable all Blueprint-specific lint rules defined in this package.
* Enables all Blueprint-specific lint rules defined in this package.
*/

@@ -22,0 +22,0 @@ module.exports = {

@@ -25,4 +25,4 @@ /*

// find all pt- prefixed classes, except those that begin with pt-icon (handled by other rules).
// currently support "pt-", "bp3-", "bp4-" prefixes.
const BLUEPRINT_CLASSNAME_PATTERN = /(?<![\w])((?:pt|bp3|bp4)-(?!icon)[\w-]+)/g;
// currently supports "pt-", "bp3-", "bp4-", "bp5-" prefixes.
const BLUEPRINT_CLASSNAME_PATTERN = /(?<![\w])((?:pt|bp3|bp4|bp5)-(?!icon)[\w-]+)/g;

@@ -167,3 +167,3 @@ type MessageIds = "useBlueprintClasses";

const className = text
.replace(/(pt|bp3|bp4)-/, "")
.replace(/(pt|bp3|bp4|bp5)-/, "")
.replace(/-/g, "_")

@@ -170,0 +170,0 @@ .toUpperCase();

@@ -26,3 +26,2 @@ /*

noDeprecatedTableComponentsRule,
noDeprecatedTimezoneComponentsRule,
} from "./no-deprecated-components";

@@ -41,4 +40,3 @@ import { noDeprecatedTypeReferencesRule } from "./no-deprecated-type-references";

"no-deprecated-table-components": noDeprecatedTableComponentsRule,
"no-deprecated-timezone-components": noDeprecatedTimezoneComponentsRule,
"no-deprecated-type-references": noDeprecatedTypeReferencesRule,
};

@@ -10,2 +10,1 @@ /*

export * from "./no-deprecated-table-components";
export * from "./no-deprecated-timezone-components";

@@ -10,3 +10,2 @@ /*

import { tableComponentsMigrationMapping } from "./no-deprecated-table-components";
import { timezoneComponentsMigrationMapping } from "./no-deprecated-timezone-components";

@@ -21,9 +20,3 @@ /**

"no-deprecated-components",
[
"@blueprintjs/core",
"@blueprintjs/datetime",
"@blueprintjs/select",
"@blueprintjs/table",
"@blueprintjs/timezone",
],
["@blueprintjs/core", "@blueprintjs/datetime", "@blueprintjs/select", "@blueprintjs/table"],
{

@@ -34,4 +27,3 @@ ...coreComponentsMigrationMapping,

...tableComponentsMigrationMapping,
...timezoneComponentsMigrationMapping,
},
);

@@ -8,11 +8,4 @@ /*

export const coreComponentsMigrationMapping = {
AbstractComponent: "AbstractComponent2",
AbstractPureComponent: "AbstractPureComponent2",
Breadcrumbs: "Breadcrumbs2",
CollapsibleList: "OverflowList",
"MenuItem.popoverProps": "MenuItem2",
// TODO(@adidahiya): Blueprint v6
// PanelStack: "PanelStack2",
Popover: "Popover2",
Tooltip: "Tooltip2",
};

@@ -19,0 +12,0 @@

@@ -8,4 +8,2 @@ /*

export const datetimeComponentsMigrationMapping = {
DateInput: "DateInput2",
DateRangeInput: "DateRangeInput2",
// TODO(@adidahiya): Blueprint v6

@@ -12,0 +10,0 @@ // DateTimePicker: "DatePicker",

@@ -8,5 +8,3 @@ /*

export const selectComponentsMigrationMapping = {
MultiSelect: "MultiSelect2",
Select: "Select2",
Suggest: "Suggest2",
// nothing, for now
};

@@ -13,0 +11,0 @@

@@ -8,8 +8,4 @@ /*

export const tableComponentsMigrationMapping = {
JSONFormat: "JSONFormat2",
TruncatedFormat: "TruncatedFormat2",
// TODO(@adidahiya): Blueprint v6
// ColumnHeaderCell: "ColumnHeaderCell2",
// EditableCell: "EditableCell2",
// RowHeaderCell: "RowHeaderCell2",
// Table: "Table2",

@@ -16,0 +12,0 @@ };

@@ -148,4 +148,2 @@ /*

],
"@blueprintjs/timezone": ["ITimezoneItem", "ITimezonePickerProps"],
};

@@ -152,0 +150,0 @@

@@ -36,42 +36,24 @@ /*

ruleTester.run("no-deprecated-components", noDeprecatedComponentsRule, {
invalid: [
invalid: [],
valid: [
{
code: dedent`
import { CollapsibleList } from "@blueprintjs/core";
import { Button } from "@blueprintjs/core";
return <CollapsibleList />
return <Button />
`,
errors: [
{
messageId: "migration",
data: { deprecatedComponentName: "CollapsibleList", newComponentName: "OverflowList" },
},
],
},
{
code: dedent`
import * as BP from "@blueprintjs/core";
import { OverflowList } from "@blueprintjs/core";
return <BP.CollapsibleList />
return <OverflowList />
`,
errors: [
{
messageId: "migration",
data: { deprecatedComponentName: "CollapsibleList", newComponentName: "OverflowList" },
},
],
},
{
code: dedent`
import { AbstractComponent } from "@blueprintjs/core";
import { OverflowList } from "@blueprintjs/core";
export class MyClass extends AbstractComponent {
}
export class MyList extends OverflowList {}
`,
errors: [
{
messageId: "migration",
data: { deprecatedComponentName: "AbstractComponent", newComponentName: "AbstractComponent2" },
},
],
},

@@ -82,37 +64,17 @@ {

export class MyClass extends BP.AbstractComponent {
}
class MyClass2 extends BP.AbstractComponent {}
return <BP.Button />
`,
errors: [
{
messageId: "migration",
data: { deprecatedComponentName: "AbstractComponent", newComponentName: "AbstractComponent2" },
},
{
messageId: "migration",
data: { deprecatedComponentName: "AbstractComponent", newComponentName: "AbstractComponent2" },
},
],
},
{
code: dedent`
import { TimezonePicker } from "@blueprintjs/timezone";
import { CollapsibleList } from "@blueprintjs/core";
return <TimezonePicker />;
return <CollapsibleList />
`,
errors: [
{
messageId: "migration",
data: { deprecatedComponentName: "TimezonePicker", newComponentName: "TimezoneSelect" },
},
],
},
],
valid: [
{
code: dedent`
import { Button } from "@blueprintjs/core";
import * as BP from "@blueprintjs/core";
return <Button />
return <BP.CollapsibleList />
`,

@@ -122,5 +84,6 @@ },

code: dedent`
import { OverflowList } from "@blueprintjs/core";
import { AbstractComponent } from "@blueprintjs/core";
return <OverflowList />
export class MyClass extends AbstractComponent {
}
`,

@@ -130,12 +93,7 @@ },

code: dedent`
import { OverflowList } from "@blueprintjs/core";
export class MyList extends OverflowList {}
`,
},
{
code: dedent`
import * as BP from "@blueprintjs/core";
return <BP.Button />
export class MyClass extends BP.AbstractComponent {
}
class MyClass2 extends BP.AbstractComponent {}
`,

@@ -142,0 +100,0 @@ },

@@ -38,3 +38,4 @@ /*

// for more specific violations which involve certain deprecated props
invalid: [
invalid: [],
valid: [
{

@@ -44,14 +45,4 @@ code: dedent`

return <MenuItem popoverProps={{ boundary: "window" }} />
return <MenuItem text="Open in new tab" icon="share" />
`,
errors: [
{
messageId: "migrationWithPropUsage",
data: {
deprecatedComponentName: "MenuItem",
deprecatedPropName: "popoverProps",
newComponentName: "MenuItem2",
},
},
],
},

@@ -62,17 +53,5 @@ {

return <Blueprint.MenuItem popoverProps={{ boundary: "window" }} />
return <Blueprint.MenuItem text="Open in new tab" icon="share" />
`,
errors: [
{
messageId: "migrationWithPropUsage",
data: {
deprecatedComponentName: "MenuItem",
deprecatedPropName: "popoverProps",
newComponentName: "MenuItem2",
},
},
],
},
],
valid: [
{

@@ -82,3 +61,3 @@ code: dedent`

return <MenuItem text="Open in new tab" icon="share" />
return <MenuItem popoverProps={{ boundary: "window" }} />
`,

@@ -90,3 +69,3 @@ },

return <Blueprint.MenuItem text="Open in new tab" icon="share" />
return <Blueprint.MenuItem popoverProps={{ boundary: "window" }} />
`,

@@ -93,0 +72,0 @@ },

@@ -38,3 +38,4 @@ /*

// for more specific violations which involve certain syntax
invalid: [
invalid: [],
valid: [
{

@@ -46,14 +47,4 @@ code: dedent`

`,
errors: [
{
messageId: "migration",
data: {
deprecatedComponentName: "MultiSelect",
newComponentName: "MultiSelect2",
},
},
],
},
],
valid: [],
});

@@ -106,25 +106,6 @@ /*

// N.B. it is difficult to test fixes of multiple violations with ESLint's RuleTester, so we cannot have a test
// case with both `ISelectProps` and `ITimezoneItem`.
// N.B. it is difficult to test fixes of multiple violations with ESLint's RuleTester,
// see https://github.com/eslint/eslint/issues/11187#issuecomment-470990425
{
code: dedent`
import { Select } from "@blueprintjs/select";
import { ITimezoneItem } from "@blueprintjs/timezone";
const MySelect = Select.ofType<ITimezoneItem>();
`,
errors: [
{
messageId: "migration",
data: { deprecatedTypeName: "ITimezoneItem", newTypeName: "TimezoneItem" },
},
],
output: dedent`
import { Select } from "@blueprintjs/select";
import { TimezoneItem } from "@blueprintjs/timezone";
const MySelect = Select.ofType<TimezoneItem>();
`,
},
{
code: dedent`
import { ISelectProps } from "@blueprintjs/select";

@@ -131,0 +112,0 @@ const mySelectProps: ISelectProps = { items: [] };

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc