dev-packages/private-eslint-plugin/README.md
The @theia/eslint-plugin contributes rules useful for Eclipse Theia development.
The plugin helps identify problems during development through static analysis including code quality, potential issues and code smells.
annotation-checkInversify >=6.1 requires to annotate all constructor parameters of injectable classes as otherwise runtime errors are thrown.
The rule checks that all constructor parameters of injectable classes are annotated with @inject, @unmanaged or @multiInject.
localization-checkThe rule prevents the following localization related issues:
nls.localizeByDefault function by using an incorrect default value.nls.localize which could be replaced by nls.localizeByDefault.named-logger-checkThe rule enforces the logging guidelines:
@injectable() classes must log through an injected ILogger instead of console.log, console.info, console.warn, console.error, console.debug or console.trace. Console methods without an ILogger counterpart, such as console.time or console.group, are allowed.ILogger must carry a @named decorator whose value follows [optional-purpose]package-name:class-name#optional-suffix. The package segment is checked against the name of the closest package.json without its npm scope, the class segment against the enclosing class. A @named value which is not a string literal is not checked.Code without an ILogger binding is exempted through ESLint itself rather than by the rule:
electron-main runtime is turned off in the overrides of configs/errors.eslintrc.json, as the Electron main container binds no ILogger.eslint-disable @theia/named-logger-check with the reason.no-src-importThe rule prevents imports using /src/ rather than /lib/ as it causes build failures.
The rule helps developers more easily identify the cause of build errors caused by the incorrect import.
runtime-import-checkThe rule prevents imports from folders meant for incompatible runtimes. The check enforces the code organization guidelines of the framework and guards against invalid imports which may cause unforeseen issues downstream.
shared-dependenciesThe rule prevents the following:
@theia/core.@theia/core."Theia" is a trademark of the Eclipse Foundation https://www.eclipse.org/theia