onnxruntime
280 строк · 9.2 Кб
1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT License.
3
4'use strict';5
6module.exports = {7root: true,8ignorePatterns: [9'**/*.js',10'node_modules/',11'ort-schema/',12'common/test/type-tests/',13'web/types.d.ts',14'test/data/',15'dist/',16],17env: { es6: true },18parser: '@typescript-eslint/parser',19parserOptions: { project: true, sourceType: 'module' },20plugins: ['@typescript-eslint', 'prefer-arrow', 'header', 'import', 'unicorn', 'jsdoc'],21rules: {22'unicorn/filename-case': 'error',23'header/header': [242,25'line',26[' Copyright (c) Microsoft Corporation. All rights reserved.', ' Licensed under the MIT License.'],272,28],29'import/no-extraneous-dependencies': ['error', { devDependencies: false }],30'import/no-internal-modules': [31'error',32{33allow: ['**/lib/**'],34},35],36'import/no-unassigned-import': 'error',37'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],38'@typescript-eslint/await-thenable': 'error',39'@typescript-eslint/ban-types': [40'error',41{42types: {43Object: { message: 'Use {} instead.' },44String: { message: "Use 'string' instead." },45Number: { message: "Use 'number' instead." },46Boolean: { message: "Use 'boolean' instead." },47},48},49],50'@typescript-eslint/naming-convention': 'error',51'@typescript-eslint/consistent-type-assertions': 'error',52'@typescript-eslint/member-delimiter-style': [53'error',54{55multiline: { delimiter: 'semi', requireLast: true },56singleline: { delimiter: 'semi', requireLast: false },57},58],59'@typescript-eslint/no-empty-function': 'error',60'@typescript-eslint/no-explicit-any': 'error',61'@typescript-eslint/no-floating-promises': 'error',62'@typescript-eslint/no-for-in-array': 'error',63'@typescript-eslint/no-inferrable-types': 'error',64'@typescript-eslint/no-misused-new': 'error',65'@typescript-eslint/no-namespace': ['error', { allowDeclarations: true }],66'@typescript-eslint/no-non-null-assertion': 'off',67'@typescript-eslint/no-require-imports': ['error', { allow: ['^node:'] }],68'@typescript-eslint/no-var-requires': ['error', { allow: ['^node:'] }],69'@typescript-eslint/no-unnecessary-type-assertion': 'error',70'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],71'@typescript-eslint/promise-function-async': 'error',72'@typescript-eslint/restrict-plus-operands': 'error',73'@typescript-eslint/semi': ['error', 'always'],74'@typescript-eslint/triple-slash-reference': ['error', { path: 'always', types: 'prefer-import', lib: 'always' }],75'arrow-body-style': 'error',76camelcase: 'error',77'constructor-super': 'error',78curly: 'error',79'default-case': 'error',80'dot-notation': 'error',81eqeqeq: ['error', 'smart'],82'guard-for-in': 'error',83'id-match': 'error',84'new-parens': 'error',85'no-bitwise': 'error',86'no-caller': 'error',87'no-cond-assign': 'error',88'no-console': 'error',89'no-constant-condition': 'error',90'no-control-regex': 'error',91'no-debugger': 'error',92'no-duplicate-case': 'error',93'no-empty': 'error',94'no-eval': 'error',95'no-extra-bind': 'error',96'no-invalid-regexp': 'error',97'no-invalid-this': 'error',98'no-multiple-empty-lines': 'error',99'no-new-func': 'error',100'no-new-wrappers': 'error',101'no-octal': 'error',102'no-octal-escape': 'error',103'no-param-reassign': 'error',104'no-redeclare': 'off',105'@typescript-eslint/no-redeclare': ['error'],106'no-regex-spaces': 'error',107'no-return-await': 'error',108'no-sparse-arrays': 'error',109'no-template-curly-in-string': 'error',110'no-throw-literal': 'error',111'no-undef-init': 'error',112'no-underscore-dangle': 'error',113'no-unsafe-finally': 'error',114'no-unused-expressions': 'error',115'no-unused-labels': 'error',116'no-use-before-define': 'off',117'@typescript-eslint/no-use-before-define': 'error',118'no-var': 'error',119'object-shorthand': 'error',120'prefer-arrow/prefer-arrow-functions': 'error',121'prefer-const': 'error',122radix: 'error',123'use-isnan': 'error',124},125overrides: [126{127files: ['node/**/*.ts'],128env: { es6: true, node: true },129},130{131files: ['common/lib/**/*.ts', 'node/lib/**/*.ts'],132rules: {133'jsdoc/check-alignment': 'error',134'jsdoc/check-indentation': 'error',135},136},137{138files: ['common/test/**/*.ts'],139rules: {140'@typescript-eslint/naming-convention': 'off',141'import/no-extraneous-dependencies': 'off',142},143},144{145files: ['node/script/**/*.ts', 'node/test/**/*.ts', 'web/script/**/*.ts', 'web/test/**/*.ts'],146rules: {147'@typescript-eslint/naming-convention': 'off',148'@typescript-eslint/no-empty-function': 'off',149'@typescript-eslint/no-explicit-any': 'off',150'@typescript-eslint/no-require-imports': 'off',151'@typescript-eslint/no-var-requires': 'off',152'@typescript-eslint/no-unnecessary-type-assertion': 'off',153camelcase: 'off',154'prefer-arrow/prefer-arrow-functions': 'off',155'import/no-extraneous-dependencies': 'off',156'import/no-unassigned-import': 'off',157'import/no-internal-modules': 'off',158'no-console': 'off',159'no-empty': 'off',160'no-unused-expressions': 'off',161},162},163{164files: ['web/lib/**/*.ts'],165rules: {166'no-underscore-dangle': [167'error',168{169allow: [170'_free',171'_malloc',172'_JsepGetNodeName',173'_JsepOutput',174'_OrtAddFreeDimensionOverride',175'_OrtAddRunConfigEntry',176'_OrtAddSessionConfigEntry',177'_OrtAppendExecutionProvider',178'_OrtBindInput',179'_OrtBindOutput',180'_OrtClearBoundOutputs',181'_OrtCreateBinding',182'_OrtCreateRunOptions',183'_OrtCreateSession',184'_OrtCreateSessionOptions',185'_OrtCreateTensor',186'_OrtEndProfiling',187'_OrtFree',188'_OrtGetInputName',189'_OrtGetInputOutputCount',190'_OrtGetLastError',191'_OrtGetOutputName',192'_OrtGetTensorData',193'_OrtInit',194'_OrtReleaseBinding',195'_OrtReleaseRunOptions',196'_OrtReleaseSession',197'_OrtReleaseSessionOptions',198'_OrtReleaseTensor',199'_OrtRun',200'_OrtRunWithBinding',201'_OrtTrainingCopyParametersFromBuffer',202'_OrtTrainingCopyParametersToBuffer',203'_OrtTrainingCreateSession',204'_OrtTrainingEvalStep',205'_OrtTrainingGetModelInputOutputCount',206'_OrtTrainingGetModelInputOutputName',207'_OrtTrainingGetParametersSize',208'_OrtTrainingLazyResetGrad',209'_OrtTrainingLoadCheckpoint',210'_OrtTrainingOptimizerStep',211'_OrtTrainingReleaseCheckpoint',212'_OrtTrainingReleaseSession',213'_OrtTrainingRunTrainStep',214],215},216],217},218},219{220files: ['web/lib/onnxjs/**/*.ts'],221rules: {222// TODO: those rules are useful. should turn on them in future (webgl refactor)223'@typescript-eslint/no-empty-function': 'off',224'@typescript-eslint/explicit-module-boundary-types': 'off',225'@typescript-eslint/no-use-before-define': 'off',226'@typescript-eslint/no-unnecessary-type-assertion': 'off',227'@typescript-eslint/restrict-plus-operands': 'off',228'import/no-internal-modules': 'off',229'prefer-arrow/prefer-arrow-functions': 'off',230'no-param-reassign': 'off',231'no-underscore-dangle': 'off',232'guard-for-in': 'off',233},234},235{236files: ['react_native/e2e/src/**/*.ts', 'react_native/e2e/src/**/*.tsx'],237rules: {238'@typescript-eslint/no-non-null-assertion': 'off',239'@typescript-eslint/no-unnecessary-type-assertion': 'off',240'unicorn/filename-case': 'off',241'no-invalid-this': 'off',242'no-console': 'off',243},244},245{246files: ['react_native/lib/**/*.ts'],247rules: {248'@typescript-eslint/naming-convention': 'off',249},250},251{252files: ['react_native/scripts/**/*.ts'],253rules: {254'import/no-extraneous-dependencies': 'off',255'prefer-arrow/prefer-arrow-functions': 'off',256'no-console': 'off',257},258},259{260files: ['scripts/**/*.ts'],261rules: {262'import/no-extraneous-dependencies': 'off',263'no-console': 'off',264},265},266{267files: ['web/lib/**/3rd-party/**/*.ts'],268rules: {269'header/header': 'off',270'unicorn/filename-case': 'off',271'@typescript-eslint/explicit-module-boundary-types': 'off',272},273},274],275extends: [276'eslint:recommended',277'plugin:@typescript-eslint/eslint-recommended',278'plugin:@typescript-eslint/recommended',279],280};281