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

Write secure-redirect eslint rule #912

Merged
merged 9 commits into from
Oct 15, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/frontend-linters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install pnpm
- name: Install latest pnpm
working-directory: ${{env.working-directory}}
run: |
npm install -g pnpm &&
npm --version &&
npm list -g --depth 0
pnpm --version &&
pnpm list -g --depth 0
- name: Install prettier
working-directory: ${{env.working-directory}}
run: pnpm add --save-dev prettier
Expand Down
15 changes: 0 additions & 15 deletions frontend/.eslintignore

This file was deleted.

5 changes: 4 additions & 1 deletion frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ module.exports = {
'plugin:storybook/recommended'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
plugins: ['@typescript-eslint', 'eslint-plugin-intuitem-sveltekit'],
rules: {
'eslint-plugin-intuitem-sveltekit/secure-redirect': 'error'
},
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
Expand Down
1 change: 1 addition & 0 deletions frontend/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ node_modules
!.env.example
/tests/reports/*
/tests/results/*
**/paraglide

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
Expand Down
82 changes: 82 additions & 0 deletions frontend/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import intuitemSveltekit from './plugins/eslint/eslint-plugin-intuitem-sveltekit/index.js';
import globals from 'globals';
import tsParser from '@typescript-eslint/parser';
import parser from 'svelte-eslint-parser';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [
{
ignores: [
'**/.DS_Store',
'**/node_modules',
'build',
'.svelte-kit',
'package',
'**/.env',
'**/.env.*',
'!**/.env.example',
'tests/reports/*',
'tests/results/*',
'**/pnpm-lock.yaml',
'**/package-lock.json',
'**/yarn.lock'
]
},
...compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:svelte/recommended',
'prettier',
'plugin:storybook/recommended'
),
{
plugins: {
'@typescript-eslint': typescriptEslint,
'eslint-plugin-intuitem-sveltekit': intuitemSveltekit
},

languageOptions: {
globals: {
...globals.browser,
...globals.node
},

parser: tsParser,
ecmaVersion: 2020,
sourceType: 'module',

parserOptions: {
extraFileExtensions: ['.svelte']
}
},

rules: {
'eslint-plugin-intuitem-sveltekit/secure-redirect': 'error'
}
},
{
files: ['**/*.svelte'],

languageOptions: {
parser: parser,
ecmaVersion: 5,
sourceType: 'script',

parserOptions: {
parser: '@typescript-eslint/parser'
}
}
}
];
Loading
Loading