Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v1/contrib' into feature/range-s…
Browse files Browse the repository at this point in the history
…lider-update

# Conflicts:
#	packages/uui-color-picker/lib/uui-color-picker.element.ts
#	packages/uui-range-slider/lib/uui-range-slider.element.ts
  • Loading branch information
nielslyngsoe committed Oct 17, 2023
2 parents 59b05b0 + 830d6f5 commit 846bcd0
Show file tree
Hide file tree
Showing 104 changed files with 4,414 additions and 4,204 deletions.
36 changes: 36 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
{
"name": "Node.js & TypeScript",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye",

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "npm install",
"customizations": {
"vscode": {
"extensions": [
"esbenp.prettier-vscode",
"streetsidesoftware.code-spell-checker"
]
}
},
"portsAttributes": {
"6006": {
"label": "Storybook",
"onAutoForward": "notify"
}
}

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
4 changes: 3 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
ignorePatterns: ['vite.*.js', 'packages/**/*.js', 'src/**/*'],
root: true,
plugins: ['html', 'import'],
plugins: ['html', 'import', 'eslint-plugin-local-rules'],
overrides: [
{
files: ['*.ts', '*.tsx'],
Expand All @@ -25,6 +25,8 @@ module.exports = {
'@typescript-eslint/ban-types': 'off', //TODO: Remove (maybe)
'lit/no-useless-template-literals': 'error',
'lit/prefer-nothing': 'error',
'local-rules/uui-class-prefix': 'warn',
'local-rules/prefer-static-styles-last': 'warn',
},
parserOptions: {
project: './tsconfig.json',
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"cSpell.words": ["combobox", "cssprop", "noopener", "noreferrer", "Umbraco"]
"cSpell.words": ["combobox", "cssprop", "noopener", "noreferrer", "Umbraco"],
"npm.enableRunFromFolder": true
}
16 changes: 16 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "build",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"label": "npm: build",
"detail": "Builds each package"
}
]
}
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# [Umbraco UI Library](https://uui.umbraco.com/)

[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](../LICENSE.md) [![Twitter](https://img.shields.io/twitter/follow/umbraco.svg?style=social&label=Follow)](https://twitter.com/intent/follow?screen_name=umbraco)
[![Build](https://github.com/umbraco/Umbraco.UI/actions/workflows/tests.yml/badge.svg)](https://github.com/umbraco/Umbraco.UI/actions/workflows/tests.yml) [![Storybook](https://github.com/umbraco/Umbraco.UI/actions/workflows/azure-static-web-apps-delightful-beach-055ecb503.yml/badge.svg)](https://github.com/umbraco/Umbraco.UI/actions/workflows/azure-static-web-apps-delightful-beach-055ecb503.yml) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](../LICENSE.md) [![Twitter](https://img.shields.io/twitter/follow/umbraco.svg?style=social&label=Follow)](https://twitter.com/intent/follow?screen_name=umbraco)

This is a UI-library for [Umbraco CMS](https://umbraco.com/) and friends. It is a collection of user interface components that can be used to build Umbraco style interfaces.

Expand Down Expand Up @@ -141,3 +141,6 @@ See the rest of [the scripts here](docs/SCRIPTS.md).

- 📥 Pull requests and 🌟 Stars are always welcome.
- Read our [contributing guide](docs/CONTRIBUTING.md) to get started.
- Please report bugs and feature requests in the [issue tracker](
- The main branch is the latest development branch. Please make your pull requests against this branch: `v1/contrib`
- You can see the latest features in the Storybook attached to this branch: [v1/contrib](https://delightful-beach-055ecb503-v1contrib.westeurope.azurestaticapps.net/)
2 changes: 1 addition & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Using Typescript is mandatory when contributing to this repository, although it
### How to get started

1. Make sure you have the recommended version of node.js and npm installed
1. Currently we use node.js v16 and npm v8
1. Currently we use node.js v18.16.0 and npm v9.5.0
2. Run `npm install`
3. Run `npm run storybook` to start the storybook server, which we also use for development

Expand Down
88 changes: 88 additions & 0 deletions eslint-local-rules.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
'use strict';

// eslint-disable-next-line no-undef
module.exports = {
/** @type {import('eslint').Rule.RuleModule} */
'uui-class-prefix': {
meta: {
type: 'problem',
docs: {
description:
'Ensure that all class declarations are prefixed with "UUI"',
category: 'Best Practices',
recommended: true,
},
schema: [],
},
create: function (context) {
function checkClassName(node) {
if (node.id && node.id.name && !node.id.name.startsWith('UUI')) {
context.report({
node: node.id,
message: 'Class declaration should be prefixed with "UUI"',
});
}
}

return {
ClassDeclaration: checkClassName,
};
},
},

/** @type {import('eslint').Rule.RuleModule}*/
'prefer-static-styles-last': {
meta: {
type: 'suggestion',
docs: {
description:
'Enforce the "styles" property with the static modifier to be the last property of a class that ends with "Element".',
category: 'Best Practices',
recommended: true,
},
fixable: 'code',
schema: [],
},
create: function (context) {
return {
ClassDeclaration(node) {
const className = node.id.name;
if (className.endsWith('Element')) {
const staticStylesProperty = node.body.body.find(bodyNode => {
return (
bodyNode.type === 'PropertyDefinition' &&
bodyNode.key.name === 'styles' &&
bodyNode.static
);
});
if (staticStylesProperty) {
const lastProperty = node.body.body[node.body.body.length - 1];
if (lastProperty.key.name !== staticStylesProperty.key.name) {
context.report({
node: staticStylesProperty,
message:
'The "styles" property should be the last property of a class declaration.',
data: {
className: className,
},
fix: function (fixer) {
const sourceCode = context.getSourceCode();
const staticStylesPropertyText =
sourceCode.getText(staticStylesProperty);
return [
fixer.replaceTextRange(staticStylesProperty.range, ''),
fixer.insertTextAfterRange(
lastProperty.range,
'\n \n ' + staticStylesPropertyText
),
];
},
});
}
}
}
},
};
},
},
};
Loading

0 comments on commit 846bcd0

Please sign in to comment.