first commit
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
/**
|
||||
* Copyright 2025 LY Corporation
|
||||
*
|
||||
* LY Corporation licenses this file to you under the Apache License,
|
||||
* version 2.0 (the "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/// <reference types="./types.d.ts" />
|
||||
|
||||
import * as path from 'node:path';
|
||||
import { includeIgnoreFile } from '@eslint/compat';
|
||||
import eslint from '@eslint/js';
|
||||
import importPlugin from 'eslint-plugin-import';
|
||||
import turboPlugin from 'eslint-plugin-turbo';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
import headerPlugin from '@ufb/eslint-plugin-header';
|
||||
|
||||
/**
|
||||
* All packages that leverage t3-env should use this rule
|
||||
*/
|
||||
export const restrictEnvAccess = tseslint.config(
|
||||
{ ignores: ['**/env.ts'] },
|
||||
{
|
||||
files: ['**/*.js', '**/*.ts', '**/*.tsx'],
|
||||
rules: {
|
||||
'no-restricted-properties': [
|
||||
'error',
|
||||
{
|
||||
object: 'process',
|
||||
property: 'env',
|
||||
message:
|
||||
"Use `import { env } from '~/env'` instead to ensure validated types.",
|
||||
},
|
||||
],
|
||||
'no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
name: 'process',
|
||||
importNames: ['env'],
|
||||
message:
|
||||
"Use `import { env } from '~/env'` instead to ensure validated types.",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
export default tseslint.config(
|
||||
// Ignore files not tracked by VCS and any config files
|
||||
includeIgnoreFile(path.join(import.meta.dirname, '../../.gitignore')),
|
||||
{ ignores: ['**/*.config.*'] },
|
||||
{
|
||||
files: ['**/*.js', '**/*.ts', '**/*.tsx'],
|
||||
plugins: {
|
||||
import: importPlugin,
|
||||
turbo: turboPlugin,
|
||||
header: headerPlugin,
|
||||
},
|
||||
extends: [
|
||||
eslint.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
...tseslint.configs.recommendedTypeChecked,
|
||||
...tseslint.configs.stylisticTypeChecked,
|
||||
],
|
||||
rules: {
|
||||
...turboPlugin.configs.recommended.rules,
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
|
||||
],
|
||||
'@typescript-eslint/consistent-type-imports': [
|
||||
'warn',
|
||||
{ prefer: 'type-imports', fixStyle: 'separate-type-imports' },
|
||||
],
|
||||
'@typescript-eslint/no-misused-promises': [
|
||||
2,
|
||||
{ checksVoidReturn: { attributes: false } },
|
||||
],
|
||||
'@typescript-eslint/no-unnecessary-condition': [
|
||||
'error',
|
||||
{
|
||||
allowConstantLoopConditions: true,
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
|
||||
'header/header': [
|
||||
'error',
|
||||
'block',
|
||||
[
|
||||
'*',
|
||||
' * Copyright 2025 LY Corporation',
|
||||
' *',
|
||||
' * LY Corporation licenses this file to you under the Apache License,',
|
||||
' * version 2.0 (the "License"); you may not use this file except in compliance',
|
||||
' * with the License. You may obtain a copy of the License at:',
|
||||
' *',
|
||||
' * https://www.apache.org/licenses/LICENSE-2.0',
|
||||
' *',
|
||||
' * Unless required by applicable law or agreed to in writing, software',
|
||||
' * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT',
|
||||
' * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the',
|
||||
' * License for the specific language governing permissions and limitations',
|
||||
' * under the License.',
|
||||
' ',
|
||||
],
|
||||
1,
|
||||
],
|
||||
'@typescript-eslint/no-empty-interface': 'off',
|
||||
'@typescript-eslint/no-empty-object-type': 'off',
|
||||
'@typescript-eslint/no-base-to-string': 'off',
|
||||
'@typescript-eslint/consistent-type-definitions': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
linterOptions: { reportUnusedDisableDirectives: true },
|
||||
languageOptions: { parserOptions: { projectService: true } },
|
||||
},
|
||||
);
|
||||
Reference in New Issue
Block a user