Skip to content

Commit

Permalink
feat/eslint9
Browse files Browse the repository at this point in the history
feat/eslint9
  • Loading branch information
NepipenkoIgor authored May 30, 2024
2 parents 8c97173 + afc4c47 commit 895347a
Show file tree
Hide file tree
Showing 16 changed files with 28,382 additions and 28,186 deletions.
19 changes: 0 additions & 19 deletions .eslintignore

This file was deleted.

107 changes: 0 additions & 107 deletions .eslintrc.json

This file was deleted.

2 changes: 2 additions & 0 deletions .github/hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ set -e

npm run lint

npm run snyk:test

output=$(npm run type-coverage)
if echo "$output" | grep -q "lower than "; then
echo "$output"
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ jobs:
steps:
- name: Post to a Slack channel
id: slack
uses: slackapi/slack-github-action@v1.25.0
uses: slackapi/slack-github-action@v1.26.0
with:
channel-id: 'deployments'
payload: |
{
"text": "GitHub Action build result: ${{ job.status == 'success' && ':white_check_mark:' || ':x:' }}",
"blocks": [
{
"type": "section",
Expand Down
55 changes: 51 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org/
node-version: 20

- name: Build library
run: |
npm ci --force
Expand All @@ -23,3 +23,50 @@ jobs:
run: npm run publish:lib
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

slack_notification:
needs:
- build
runs-on: ubuntu-latest
steps:
- name: Post to a Slack channel
id: slack
uses: slackapi/[email protected]
with:
channel-id: 'deployments'
payload: |
{
"text": "GitHub Action build result: ${{ job.status == 'success' && ':white_check_mark:' || ':x:' }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "GitHub Action build result: ${{ job.status == 'success' && ':white_check_mark:' || ':x:' }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Project: `${{ github.event.repository.name }}`"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Commit/PR URL: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Website URL: ${{ env.WEBSITE_URL }}"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
9 changes: 6 additions & 3 deletions .github/workflows/quality-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ on:
branches:
- develop

env:
snyk_token: ${{ secrets.SNYK_TOKEN }}

jobs:
quality-check:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
- name: Check quality
run: |
npm ci --force
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/scripts/quality.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ set -e

npm run lint

npm run snyk:auth -- $snyk_token
npm run snyk:test

output=$(npm run type-coverage)
if echo "$output" | grep -q "lower than "; then
echo "$output"
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ testem.log
Thumbs.db

.angular

# Snyk
.dccache
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "src/libraries"]
path = src/libraries
branch = main
url = https://github.com/JsDaddy/libraries.git
2 changes: 1 addition & 1 deletion cypress/support/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { mount } from 'cypress/angular';
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Cypress {
// eslint-disable-next-line @typescript-eslint/naming-convention
interface Chainable {
mount: typeof mount;
}
Expand Down
98 changes: 98 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
// @ts-check
const globals = require('globals');
// Allows us to bring in the recommended core rules from eslint itself
const eslint = require('@eslint/js');

// Allows us to use the typed utility for our config, and to bring in the recommended rules for TypeScript projects from typescript-eslint
const tseslint = require('typescript-eslint');

// Allows us to bring in the recommended rules for Angular projects from angular-eslint
const angular = require('angular-eslint');

const json = require('eslint-plugin-json');

const ignores = [
'dist/',
'tmp/',
'out-tsc/',
'bazel-out/',
'node_modules/',
'.idea/',
'.vscode/',
'.history/',
'.angular/',
'coverage/',
'coverage-ts/',
'package-lock.json',
];

// Export our config array, which is composed together thanks to the typed utility function from typescript-eslint
module.exports = tseslint.config(
{
ignores,
},
{
// Everything in this config object targets our TypeScript files (Components, Directives, Pipes etc)
files: ['**/*.ts'],
extends: [
// Apply the recommended core rules
eslint.configs.recommended,
// Apply the recommended TypeScript rules
...tseslint.configs.recommended,
// Optionally apply stylistic rules from typescript-eslint that improve code consistency
...tseslint.configs.stylistic,
// Apply the recommended Angular rules
...angular.configs.tsRecommended,
],
// Set the custom processor which will allow us to have our inline Component templates extracted
// and treated as if they are HTML files (and therefore have the .html config below applied to them)
processor: angular.processInlineTemplates,
// Override specific rules for TypeScript files (these will take priority over the extended configs above)
rules: {
'@angular-eslint/directive-selector': [
'error',
{
type: 'attribute',
prefix: ["ngxCopyPaste", "jsdaddy"],
style: 'camelCase',
},
],
'@angular-eslint/component-selector': [
'error',
{
type: 'element',
prefix: 'jsdaddy',
style: 'kebab-case',
},
],
},
},
{
// Everything in this config object targets our HTML files (external templates,
// and inline templates as long as we have the `processor` set on our TypeScript config above)
files: ['**/*.html'],
extends: [
// Apply the recommended Angular template rules
...angular.configs.templateRecommended,
// Apply the Angular template rules which focus on accessibility of our apps
...angular.configs.templateAccessibility,
],
rules: {},
},
{
files: ['**/*.js'],
extends: [eslint.configs.recommended],
languageOptions: {
sourceType: 'commonjs',
globals: {
...globals.node,
},
},
rules: {},
},
{
files: ['**/*.json'],
extends: [json.configs.recommended],
rules: {},
}
);
Loading

0 comments on commit 895347a

Please sign in to comment.