Skip to content

Commit

Permalink
further linting cleanup
Browse files Browse the repository at this point in the history
This shouldn't have any effect on generated code.
  • Loading branch information
throwaway96 committed Mar 17, 2024
1 parent eece556 commit 8f07004
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 18 deletions.
6 changes: 5 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.js]
[*.{js,mjs,cjs,ts}]
indent_style = space
indent_size = 2
max_line_length = 140
quote_type = single

[*.py]
indent_style = space
Expand Down
5 changes: 0 additions & 5 deletions .prettierrc

This file was deleted.

38 changes: 29 additions & 9 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import ts from 'typescript-eslint';

import jsoncParser from 'jsonc-eslint-parser';

import prettierPlugin from 'eslint-plugin-prettier';
import importPlugin from 'eslint-plugin-import';

import prettierConfig from 'eslint-config-prettier';
/* includes the plugin and enables the rules */
import prettierRecommendedConfig from 'eslint-plugin-prettier/recommended';

import globals from 'globals';

Expand Down Expand Up @@ -40,25 +40,33 @@ export default ts.config(
js.configs.recommended,
...ts.configs.strictTypeChecked,
...airbnbCompat,
prettierConfig,
prettierRecommendedConfig,
{
/* all JS/TS files */
files: ['**/*.{js,mjs,cjs,ts}'],
linterOptions: {
/* disable for now */
// reportUnusedDisableDirectives: 'warn',
},
plugins: {
prettier: prettierPlugin,
import: importPlugin,
},
rules: {
'prettier/prettier': ['error'],
'prettier/prettier': [
'error',
{
trailingComma: 'all',
},
],
/* allow names that start with _ to be unused */
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
/* varsIgnorePattern affects catch as well */
varsIgnorePattern: '^_',
},
],
Expand Down Expand Up @@ -115,7 +123,7 @@ export default ts.config(
},
},
{
files: ['services/**/*.{js,ts}', 'tools/*.js', 'eslint.config.{js,cjs,mjs}', 'webpack.config.js'],
files: ['services/**/*.{js,ts}', 'tools/*.js', 'eslint.config.{js,mjs,cjs}', 'webpack.config.js'],
/* all of these use node */
languageOptions: {
globals: {
Expand All @@ -140,13 +148,18 @@ export default ts.config(
},
{
files: ['tools/*.js'],
languageOptions: {
/* these scripts run during build, so they can use recent Node.js */
ecmaVersion: 'latest',
sourceType: 'script',
},
rules: {
/* not sure how to tell it these aren't modules */
'@typescript-eslint/no-var-requires': 'off',
},
},
{
files: ['*.config.{js,cjs,mjs}'],
files: ['*.config.{js,mjs,cjs}'],
rules: {
/* obviously we need dev dependencies */
'import/no-extraneous-dependencies': [
Expand All @@ -159,7 +172,7 @@ export default ts.config(
},
},
{
files: ['eslint.config.{js,cjs,mjs}'],
files: ['eslint.config.{js,mjs,cjs}'],
rules: {
/* necessary for flat config */
'import/no-default-export': 'off',
Expand All @@ -171,4 +184,11 @@ export default ts.config(
'@typescript-eslint/no-var-requires': 'off',
},
},
{
files: ['babel.config.json', 'tsconfig.json'],
rules: {
/* has various issues (e.g., forcing arrays/objects onto a single line) */
'prettier/prettier': 'off',
},
},
);
3 changes: 1 addition & 2 deletions services/webos-service-remote/execbus.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable max-classes-per-file, no-underscore-dangle */
/* eslint-disable max-classes-per-file */
import { EventEmitter } from 'events';
import { spawn } from 'child_process';
import { asyncExecFile } from '../adapter';
Expand Down Expand Up @@ -50,7 +50,6 @@ export default class Handle {
stdout += data.toString();
let searchPos = 0;
let breakPos = 0;
// eslint-disable-next-line no-cond-assign
while ((breakPos = stdout.indexOf('\n', searchPos)) > 0) {
const line = stdout.substring(searchPos, breakPos).trim();
request.emit('response', Message.constructBody(line, true));
Expand Down
1 change: 0 additions & 1 deletion services/webos-service-remote/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export default class Message {
}

//* respond to a message, with a JSON-compatible object
// eslint-disable-next-line no-unused-vars
respond() {
throw new Error('Not implemented');
}
Expand Down

0 comments on commit 8f07004

Please sign in to comment.