mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 01:09:54 +08:00
style: enable no-non-null-assertion rule (#2723)
Co-authored-by: Peng Xiao <pengxiao@outlook.com>
(cherry picked from commit 18dc427bc3)
This commit is contained in:
+18
-17
@@ -1,3 +1,5 @@
|
||||
const { readdirSync, statSync } = require('fs');
|
||||
|
||||
const createPattern = packageName => [
|
||||
{
|
||||
group: ['**/dist', '**/dist/**'],
|
||||
@@ -21,22 +23,14 @@ const createPattern = packageName => [
|
||||
},
|
||||
];
|
||||
|
||||
const allPackages = [
|
||||
'cli',
|
||||
'component',
|
||||
'debug',
|
||||
'env',
|
||||
'graphql',
|
||||
'hooks',
|
||||
'i18n',
|
||||
'jotai',
|
||||
'native',
|
||||
'plugin-infra',
|
||||
'templates',
|
||||
'theme',
|
||||
'workspace',
|
||||
'y-indexeddb',
|
||||
];
|
||||
const pkgs = readdirSync('./packages').filter(pkg => {
|
||||
return statSync(`./packages/${pkg}`).isDirectory();
|
||||
});
|
||||
const apps = readdirSync('./apps').filter(pkg => {
|
||||
return statSync(`./apps/${pkg}`).isDirectory();
|
||||
});
|
||||
|
||||
const allPackages = pkgs.concat(apps);
|
||||
|
||||
/**
|
||||
* @type {import('eslint').Linter.Config}
|
||||
@@ -67,6 +61,7 @@ const config = {
|
||||
},
|
||||
ecmaVersion: 'latest',
|
||||
sourceType: 'module',
|
||||
project: './tsconfig.eslint.json',
|
||||
},
|
||||
plugins: [
|
||||
'react',
|
||||
@@ -83,7 +78,7 @@ const config = {
|
||||
'no-cond-assign': 'off',
|
||||
'react/prop-types': 'off',
|
||||
'@typescript-eslint/consistent-type-imports': 'error',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
@@ -136,6 +131,12 @@ const config = {
|
||||
'@typescript-eslint/no-var-requires': 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/__tests__/**/*', '**/*.stories.tsx'],
|
||||
rules: {
|
||||
'@typescript-eslint/no-non-null-assertion': 0,
|
||||
},
|
||||
},
|
||||
...allPackages.map(pkg => ({
|
||||
files: [`packages/${pkg}/src/**/*.ts`, `packages/${pkg}/src/**/*.tsx`],
|
||||
rules: {
|
||||
|
||||
Reference in New Issue
Block a user