Skip to content

Commit 6df50a1

Browse files
authored
Merge pull request #1297 from valadas/lint-0.27.1
Adds linting for v0.27.1
2 parents 4f7edbf + 1581425 commit 6df50a1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3073
-748
lines changed

.github/workflows/Deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ on:
2222
- main
2323
- master
2424
- 'release/*'
25+
tags:
26+
- 'v*'
2527

2628
jobs:
2729
ubuntu-latest:

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
node_modules/
22
.nuke/temp/
33
.vs/
4-
.vscode/
54
_build/bin
65
_build/obj

.vscode/launch.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "Test eslint rules",
11+
"runtimeExecutable": "npm",
12+
"runtimeArgs": ["run", "test.eslint-plugin"],
13+
"cwd": "${workspaceFolder}/packages/stencil-library",
14+
"console": "integratedTerminal",
15+
"autoAttachChildProcesses": true,
16+
"skipFiles": ["<node_internals>/**", "node_modules/**"],
17+
},
18+
]
19+
}

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"typescript.tsdk": "node_modules\\typescript\\lib",
3+
"codeQL.githubDatabase.download": "never"
4+
}

README.md

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,54 @@ Stencil components are just Web Components, so they work in any major framework
3434
Stay tuned - coming soon.
3535

3636
## Usage (Individual Components)
37-
Usage of each component is documented within the component folder right here on GitHub, along with some code samples too.
37+
Usage of each component is documented within the library `components` folder along with code samples.
38+
39+
## Usage (`eslint-plugin`)
40+
To help better handle breaking changes, and to provide advice regarding usage, a custom `eslint` plugin is included in this package. Some breaking changes have auto-fixes. Until we release v1.0.0, it is advisable to upgrade one minor version at a time, and if you use `eslint` or `tslint`, you can get some of the fixes applied automatically for you. We currently only support the flat config format, so you will need those set up:
41+
- `eslint` v8 (with the option to use the flat config type)
42+
- `eslint` v9 (flat config is already mandatory)
43+
- `typescript-eslint` (flat config is already mandatory) **recommended if you use typescript**
44+
45+
No additional package is needed. Just use the already installed `@dnncommunity/dnn-elements` and import the `eslint-plugin`. Then use it in your config:
46+
47+
```diff
48+
import tseslint from 'typescript-eslint';
49+
import eslint from '@eslint/js';
50+
+import dnnelements from '@dnncommunity/dnn-elements/eslint-plugin';
51+
52+
export default tseslint.config(
53+
tseslint.configs.recommendedTypeChecked,
54+
stencil.configs.flat.recommended,
55+
+ dnnelements.configs.flat.recommended,
56+
{
57+
files: [
58+
"src/**/*.{ts,tsx}",
59+
],
60+
},
61+
{
62+
ignores: [
63+
"dist/",
64+
"www/",
65+
],
66+
},
67+
{
68+
languageOptions: {
69+
ecmaVersion: "latest",
70+
sourceType: "module",
71+
parserOptions: {
72+
projectService: true,
73+
project: './tsconfig.json',
74+
}
75+
}
76+
},
77+
)
78+
```
79+
80+
## Upgrading
81+
As we worked towards a `v1.x.x` release, we had several unavoidable breaking changes to handle along the way. The above `eslint` setup is highly recommended to help you with auto-fixes to handle those breaking changes smoothly, even with hundreds of usages. This means you need to follow a known upgrade path.
82+
83+
- From `<v0.24.0` you should upgrade directly to `v0.24.4` and handle all the breaking changes (ideally using `eslint --fix`).
84+
- From `v0.24.4` - `v0.25.1` you should upgrade to `v0.26.0` and check manually if you used any of the removed CSS variables to adjust accordingly (see https://github.com/DNNCommunity/dnn-elements/pull/1252/files to spot the removals). Since this is CSS, there are no `eslint` rules to help you there.
85+
- From `v0.26.0` onwards, you should upgrade to `v0.27.1` and handle all deprecations.
86+
- From `v0.27.1 - v1.x.x` we will add auto-fixes at each latest minor release.
87+
- From `v1.x.x` we will use semantic versioning, and you can simply upgrade one major version at a time. They will include auto-fixes in the same release where breaking changes happen.

_build/Build.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
GitHubActionsImage.UbuntuLatest,
4040
ImportSecrets = new[] { nameof(GithubToken), "NPM_TOKEN" },
4141
OnPushBranches = new[] { "main", "master", "release/*" },
42+
OnPushTags = new[] { "v*" },
4243
InvokedTargets = new[] { nameof(Deploy) },
4344
FetchDepth = 0,
4445
CacheKeyFiles = new string[] {}
@@ -47,7 +48,7 @@
4748
"Publish_Site",
4849
GitHubActionsImage.UbuntuLatest,
4950
ImportSecrets = new[] { nameof(GithubToken) },
50-
OnPushBranches = new[] { "main", "master", "release/*" },
51+
OnPushBranches = new[] { "main", "master" },
5152
InvokedTargets = new[] { nameof(PublishSite) },
5253
FetchDepth = 0,
5354
CacheKeyFiles = new string[] {}
@@ -142,9 +143,6 @@ class Build : NukeBuild
142143
.SetCommand("test")
143144
.SetProcessWorkingDirectory(StencilDirectory));
144145
}
145-
NpmRun(s => s
146-
.SetProcessWorkingDirectory(StencilDirectory)
147-
.SetCommand("build-storybook"));
148146
});
149147
Target SetupGithubActor => _ => _
150148
.Executes(() =>
@@ -277,6 +275,9 @@ class Build : NukeBuild
277275
.DependsOn(Compile)
278276
.Executes(() =>
279277
{
278+
NpmRun(s => s
279+
.SetProcessWorkingDirectory(StencilDirectory)
280+
.SetCommand("build-storybook"));
280281
NpmRun(s => s
281282
.SetProcessWorkingDirectory(StencilDirectory)
282283
.SetCommand("deploy-storybook"));

0 commit comments

Comments
 (0)