Skip to content

Commit

Permalink
chore: update linter configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
kelsos committed Jan 25, 2024
1 parent 5ee758a commit f01566b
Show file tree
Hide file tree
Showing 21 changed files with 696 additions and 316 deletions.
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

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

This file was deleted.

1 change: 0 additions & 1 deletion .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ jobs:
fi
id: diff

# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Build'
on: # rebuild any PRs and main branch changes
name: Build
on:
pull_request:
push:
branches:
Expand Down Expand Up @@ -58,5 +58,5 @@ jobs:
env_file: .github/.env

- name: Echo plugin output
run: |
echo "EXAMPLE: $EXAMPLE"
run: |
echo "EXAMPLE: $EXAMPLE"
10 changes: 5 additions & 5 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: "CodeQL"
name: CodeQL

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
analyze:
Expand All @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'TypeScript' ]
language: [TypeScript]

steps:
- name: Checkout repository
Expand All @@ -34,4 +34,4 @@ jobs:
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v2
3 changes: 0 additions & 3 deletions .prettierignore

This file was deleted.

4 changes: 0 additions & 4 deletions .prettierrc.json

This file was deleted.

20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
### Basic

```yaml
steps:
- uses: actions/checkout@v3
- name: Run
uses: rotki/action-env@v1
with:
env_file: .github/.env
- name: Echo plugin output
run: |
echo "EXAMPLE: $EXAMPLE"
```
steps:
- uses: actions/checkout@v3
- name: Run
uses: rotki/action-env@v1
with:
env_file: .github/.env
- name: Echo plugin output
run: |
echo "EXAMPLE: $EXAMPLE"
```
17 changes: 9 additions & 8 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
import * as process from 'process';
import * as cp from 'child_process';
import * as path from 'path';
import { expect, test } from 'vitest';
import * as process from 'node:process';
import * as cp from 'node:child_process';
import * as path from 'node:path';
import { expect, it } from 'vitest';
import { loadEnv } from '../src/file';

test('loads from env file if the file exists', async () => {
it('loads from env file if the file exists', () => {
expect(loadEnv('.github/.env')).toMatchObject({ EXAMPLE: 'example' });
});

test('returns undefined if the env file does not exist', async () => {
it('returns undefined if the env file does not exist', () => {
expect(loadEnv('.unknown_env')).toBeUndefined();
});

// shows how the runner will run a javascript action with env / stdout protocol
test('test runs', () => {
process.env['INPUT_ENV_FILE'] = '.github/.env';
it('test runs', () => {
process.env.INPUT_ENV_FILE = '.github/.env';
const np = process.execPath;
const ip = path.join(__dirname, '..', 'lib', 'main.js');
const options: cp.ExecFileSyncOptions = {
env: process.env,
};
// eslint-disable-next-line no-console
console.log(cp.execFileSync(np, [ip], options).toString());
});
10 changes: 5 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: '@rotki/action-env'
description: 'Loads environment variables for a job from a file'
author: 'Rotki Solutions GmbH'
description: Loads environment variables for a job from a file
author: Rotki Solutions GmbH
inputs:
env_file:
required: true
description: 'The path to the environment file where the variables will be loaded from'
description: The path to the environment file where the variables will be loaded from
runs:
using: 'node20'
main: 'dist/index.js'
using: node20
main: dist/index.js
1 change: 0 additions & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-commonjs
module.exports = {
extends: ['@commitlint/config-conventional'],
};
54 changes: 20 additions & 34 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const rotki = require('@rotki/eslint-config').default;
const github = require('eslint-plugin-github');

module.exports = rotki({
typescript: {
tsconfigPath: 'tsconfig.eslint.json',
},
stylistic: true,
formatters: true,
}, {
files: ['src/**/*.ts'],
plugins: {
github,
},
rules: {
'github/array-foreach': 'error',
'github/no-implicit-buggy-globals': 'error',
'github/no-then': 'error',
'github/no-dynamic-script-tag': 'error',
},
}, {
files: ['**/*.ts'],
rules: {
'perfectionist/sort-objects': 'error',
},
});
32 changes: 15 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,35 @@
"name": "@rotki/action-env",
"version": "2.0.0",
"private": true,
"packageManager": "[email protected]",
"description": "Loads environment variables from a .env file",
"keywords": [
"actions",
"node",
"setup"
],
"license": "AGPL-3.0",
"repository": {
"type": "git",
"url": "git+https://github.com/rotki/action-env.git"
},
"author": "Rotki Solutions GmbH <[email protected]>",
"main": "lib/main.js",
"packageManager": "[email protected]",
"scripts": {
"build": "tsc",
"format": "prettier --write '**/*.ts'",
"format-check": "prettier --check '**/*.ts'",
"lint": "eslint src/**/*.ts",
"lint": "eslint .",
"package": "ncc build --source-map --license licenses.txt",
"test": "vitest",
"all": "npm run build && npm run format && npm run lint && npm run package && npm test",
"all": "npm run build && npm run lint && npm run package && npm test",
"preinstall": "npx only-allow pnpm",
"release": "bumpp --no-push"
},
"repository": {
"type": "git",
"url": "git+https://github.com/rotki/action-env.git"
},
"keywords": [
"actions",
"node",
"setup"
],
"author": "Rotki Solutions GmbH <[email protected]>",
"license": "AGPL-3.0",
"dependencies": {
"@actions/core": "1.10.1",
"dotenv": "16.4.1"
},
"devDependencies": {
"@rotki/eslint-config": "1.1.2",
"@rotki/eslint-config": "2.4.4",
"@types/node": "20.11.6",
"@vercel/ncc": "0.38.1",
"bumpp": "9.3.0",
Expand Down
Loading

0 comments on commit f01566b

Please sign in to comment.