Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): remove stylelint-config-prettier #1606

Merged
merged 2 commits into from
Jul 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"extends": [
"stylelint-config-standard",
"stylelint-config-rational-order",
"stylelint-config-prettier"
"stylelint-config-rational-order"
],
"customSyntax": "postcss-less",
"plugins": [
Expand Down Expand Up @@ -53,7 +52,6 @@
}
],
"no-invalid-double-slash-comments": null,
"indentation": [ 2 ],
"import-notation": "string",
"media-feature-range-notation": "prefix"
}
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@
"readline-sync": "^1.4.10",
"stream": "0.0.2",
"stylelint": "^15.6.2",
"stylelint-config-prettier": "^9.0.5",
"stylelint-config-rational-order": "^0.1.2",
"stylelint-config-standard": "^33.0.0",
"stylelint-declaration-block-no-ignored-properties": "^2.7.0",
Expand Down
5 changes: 5 additions & 0 deletions packages/abc/page-header/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,19 @@
min-width: 242px;
margin-left: 88px;
}

@media screen and (max-width: @screen-xl) {
&__extra {
margin-left: 44px;
}
}

@media screen and (max-width: @screen-lg) {
&__extra {
margin-left: 20px;
}
}

@media screen and (max-width: @screen-md) {
&__row {
display: block;
Expand All @@ -118,11 +121,13 @@
margin-left: 0;
}
}

@media screen and (max-width: @screen-sm) {
&__detail {
display: block;
}
}

@media screen and (max-width: @screen-xs) {
&__action {
.@{ant-prefix}-btn-group,
Expand Down
2 changes: 2 additions & 0 deletions packages/abc/page-header/style/rtl.less
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
margin-right: 88px;
margin-left: 0;
}

@media screen and (max-width: @screen-xl) {
&__extra {
margin-right: 44px;
margin-left: 0;
}
}

@media screen and (max-width: @screen-lg) {
&__extra {
margin-right: 20px;
Expand Down
3 changes: 3 additions & 0 deletions packages/form/src/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
}
}
}

@media (max-width: @mobile-max) {
> .@{ant-prefix}-form-item {
> .@{ant-prefix}-form-item-label,
Expand Down Expand Up @@ -180,6 +181,7 @@
margin-right: 0;
}
}

@media (max-width: @mobile-max) {
@{sf-prefix}__item {
display: block;
Expand Down Expand Up @@ -207,6 +209,7 @@
overflow: hidden;
text-overflow: ellipsis;
}

@media (max-width: @mobile-max) {
.@{ant-prefix}-form-item-label > label {
justify-content: flex-start;
Expand Down
1 change: 0 additions & 1 deletion packages/theme/default.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@import './theme-default.less';

@import './system/index.less';
@import './layout-default/style/index.less';
@import './layout-blank/style/index.less';
Expand Down
1 change: 0 additions & 1 deletion packages/theme/layout-blank/style/index.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import './theme-default.less';

@import './_layout.less';
@import './fix/index.less';
1 change: 1 addition & 0 deletions packages/theme/layout-default/style/_aside.less
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
left: 0;
}
}

@media (max-width: @mobile-max) {
@{alain-default-prefix}__content {
transform: translate3d(-@alain-default-aside-wd, 0, 0);
Expand Down
1 change: 1 addition & 0 deletions packages/theme/layout-default/style/_layout.less
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ body {
&__unwrap {
margin-right: -@alain-default-content-padding;
margin-left: -@alain-default-content-padding;

@media (max-width: @mobile-max) {
margin-right: 0;
margin-left: 0;
Expand Down
1 change: 1 addition & 0 deletions packages/theme/layout-default/style/fix/_sidebar-nav.less
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@
left: @layout-gutter * 2;
}
}

@media (min-width: @mobile-min) {
@{alain-default-prefix}__collapsed {
@{sidebar-nav-prefix}:not(@{sidebar-nav-prefix}__sub) {
Expand Down
6 changes: 3 additions & 3 deletions packages/theme/layout-default/style/index.less
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@import './theme-default.less';

// Layout
@import './_layout.less';
@import './_header.less';
@import './_aside.less';

// Widgets
@import './_progress-bar.less';
@import './fix/index.less';
@import './widgets/index.less';

// Fix
@import './_fixed.less';
1 change: 1 addition & 0 deletions packages/theme/layout-default/style/widgets/_user.less
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
margin-left: @layout-gutter;
}
}

@media (min-width: @mobile-min) {
@{alain-default-prefix}__collapsed {
@{alain-default-prefix}__aside-user {
Expand Down
8 changes: 8 additions & 0 deletions packages/theme/system/antd/_drawer.less
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
max-width: @drawer-sm;
}
}

@media (max-width: (@drawer-sm - 1)) {
.drawer-sm {
width: 100% !important;
Expand All @@ -19,6 +20,7 @@
max-width: @drawer-md;
}
}

@media (max-width: (@drawer-md - 1)) {
.drawer-md {
width: 100% !important;
Expand All @@ -31,6 +33,7 @@
max-width: @drawer-lg;
}
}

@media (max-width: (@drawer-lg - 1)) {
.drawer-lg {
width: 100% !important;
Expand All @@ -43,6 +46,7 @@
max-width: @drawer-xl;
}
}

@media (max-width: (@drawer-xl - 1)) {
.drawer-xl {
width: 100% !important;
Expand All @@ -58,6 +62,7 @@
max-height: @drawer-sm-height;
}
}

@media (max-height: (@drawer-sm-height - 1)) {
.drawer-sm {
height: 100% !important;
Expand All @@ -70,6 +75,7 @@
max-height: @drawer-md-height;
}
}

@media (max-height: (@drawer-md-height - 1)) {
.drawer-md {
height: 100% !important;
Expand All @@ -82,6 +88,7 @@
max-height: @drawer-lg-height;
}
}

@media (max-height: (@drawer-lg-height - 1)) {
.drawer-lg {
height: 100% !important;
Expand All @@ -94,6 +101,7 @@
max-height: @drawer-xl-height;
}
}

@media (max-height: (@drawer-xl-height - 1)) {
.drawer-xl {
height: 100% !important;
Expand Down
1 change: 0 additions & 1 deletion packages/theme/system/antd/index.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@import './_link.less';

@import './_input-number.less';
@import './_card.less';
@import './_drawer.less';
Expand Down
1 change: 0 additions & 1 deletion schematics/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ function addCodeStylesToPackageJson(): Rule {
`[email protected]`,
`[email protected]`,
`[email protected]`,
`[email protected]`,
`[email protected]`,
`[email protected]`,
`stylelint-declaration-block-no-ignored-properties@DEP-0.0.0-PLACEHOLDER`,
Expand Down
12 changes: 12 additions & 0 deletions schematics/ng-update/upgrade-rules/v16/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { JsonObject } from '@angular-devkit/core';
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';

import { createAlainApp, migrationCollection } from '../../../utils/testing';
Expand All @@ -17,4 +18,15 @@ describe('Schematic: ng-update: v16Rule', () => {
runner.logger.subscribe(e => logs.push(e.message));
await runner.runSchematic('migration-v16', {}, tree);
}

it('should be remote stylelint-config-prettier', async () => {
const filePath = 'package.json';
let json = tree.readJson(filePath) as JsonObject;
const key = 'stylelint-config-prettier';
json['devDependencies']!![key] = '*';
tree.overwrite(filePath, JSON.stringify(json));
await runMigration();
const migrationPackageJson = tree.readJson(filePath) as JsonObject;
expect(migrationPackageJson['devDependencies']!![key]).not.toBeDefined();
});
});
30 changes: 28 additions & 2 deletions schematics/ng-update/upgrade-rules/v16/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,35 @@ import { chain, Rule, SchematicContext, Tree } from '@angular-devkit/schematics'
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
import * as colors from 'ansi-colors';

import { logStart } from '../../../utils';
import { logStart, readJSON, readPackage, writeJSON, writePackage } from '../../../utils';
import { UpgradeMainVersions } from '../../../utils/versions';

function removeStylelintConfigPrettier(): Rule {
return (tree: Tree, context: SchematicContext) => {
const key = `stylelint-config-prettier`;
context.logger.info(colors.yellow(` ${key} have been deprecated`));
// remove package.json
const packageJson = readPackage(tree);
if (packageJson != null) {
delete packageJson.devDependencies[key];
writePackage(tree, packageJson);
}

// remote .stylelintrc
const stylelintrcFilePath = '.stylelintrc';
const stylelintrcjson = readJSON(tree, stylelintrcFilePath);
if (stylelintrcjson != null) {
if (!Array.isArray(stylelintrcjson.extends)) stylelintrcjson.extends = [];
const arr: string[] = stylelintrcjson.extends;
const idx = arr.indexOf(key);
if (idx !== -1) {
arr.splice(idx, 1);
writeJSON(tree, stylelintrcFilePath, stylelintrcjson);
}
}
};
}

function finished(): Rule {
return (_tree: Tree, context: SchematicContext) => {
context.addTask(new NodePackageInstallTask());
Expand All @@ -21,6 +47,6 @@ export function v16Rule(): Rule {
return async (tree: Tree, context: SchematicContext) => {
logStart(context, `Upgrade @delon/* version number`);
UpgradeMainVersions(tree);
return chain([finished()]);
return chain([removeStylelintConfigPrettier(), finished()]);
};
}
2 changes: 1 addition & 1 deletion schematics/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Jasmine = require('jasmine');
const runner = new Jasmine({ projectBaseDir });

// const files = `schematics/**/*.spec.ts`;
const files = `schematics/ng-add/index.spec.ts`;
const files = `schematics/ng-update/upgrade-rules/v16/index.spec.ts`;

const tests = glob.sync(files).map(p => relative(projectBaseDir, p));

Expand Down
1 change: 0 additions & 1 deletion scripts/ci/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ DEPENDENCIES=$(node -p "
'ajv',
'ajv-formats',
'screenfull',
'stylelint-config-prettier',
'stylelint-config-rational-order',
'stylelint-config-standard',
'stylelint-declaration-block-no-ignored-properties',
Expand Down