Skip to content

Commit

Permalink
Eslint update. Dependabot config. (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhuebner authored Dec 20, 2024
1 parent fa17cb4 commit 896cee9
Show file tree
Hide file tree
Showing 15 changed files with 2,364 additions and 539 deletions.
41 changes: 34 additions & 7 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,48 @@
version: 2
updates:
# Enable version updates for npm dependencies
# Enable version updates for root dependencies
- package-ecosystem: "npm"
directory: "/" # Location of package.json file
schedule:
interval: "weekly"
applies-to:
- security-updates
ignore:
- dependency-type: "development"
allow:
- dependency-type: "production"
- dependency-type: "all"
update-types: ["security"]

# Enable version updates for devtools extension dependencies
- package-ecosystem: "npm"
directory: "/packages/vscode-messenger-devtools"
schedule:
interval: "weekly"
ignore:
- dependency-type: "development"
allow:
- dependency-type: "all"
update-types: ["security"]

# Enable version updates for webview-ui dependencies
- package-ecosystem: "npm"
directory: "/packages/vscode-messenger-devtools/webview-ui"
schedule:
interval: "weekly"
ignore:
- dependency-type: "development"
allow:
- dependency-type: "all"
update-types: ["security"]

# Enable version updates for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/" # Location of GitHub Actions workflows
schedule:
interval: "weekly"
applies-to:
- security-updates
ignore:
- dependency-type: "development"
allow:
- dependency-type: "production"
- dependency-type: "all"
update-types: ["security"]
labels:
- "dependencies"
- "github-actions"
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '16'
node-version: '18'
- name: Build
shell: bash
run: |
Expand Down
60 changes: 37 additions & 23 deletions .eslintrc.json → eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:promise/recommended"
const js = require("@eslint/js");
const tsParser = require("@typescript-eslint/parser");
const tsPlugin = require("@typescript-eslint/eslint-plugin");
const promisePlugin = require("eslint-plugin-promise");
const globals = require('globals');

module.exports = {
files: [
"**/*.ts",
"**/*.tsx"
],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"promise"
],
"ignorePatterns": [
"**/{node_modules,lib,bin}"
ignores: [
// default ignores: ["**/node_modules/", ".git/"]
"**/lib/",
"**/out/"
],
"rules": {
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 6,
sourceType: 'module'
},
},
plugins: {
"@typescript-eslint": tsPlugin,
"promise": promisePlugin
},
rules: {
...js.configs.recommended.rules,
...promisePlugin.configs['flat/recommended'].rules,
...tsPlugin.configs.recommended.rules,
// List of [ESLint rules](https://eslint.org/docs/rules/)
"no-undef": "off", // TypeScript checks this
"arrow-parens": ["off", "as-needed"], // do not force arrow function parentheses
"constructor-super": "error", // checks the correct use of super() in sub-classes
"dot-notation": "error", // obj.a instead of obj['a'] when possible
Expand All @@ -32,7 +44,7 @@
"no-eval": "error", // eval is considered unsafe
"no-inner-declarations": "off", // we need to have 'namespace' functions when using TS 'export ='
"no-labels": "error", // GOTO is only used in BASIC ;)
"no-multiple-empty-lines": ["error", {"max": 1}], // two or more empty lines need to be fused to one
"no-multiple-empty-lines": ["error", { "max": 1 }], // two or more empty lines need to be fused to one
"no-new-wrappers": "error", // there is no reason to wrap primitve values
"no-throw-literal": "error", // only throw Error but no objects {}
"no-trailing-spaces": "error", // trim end of lines
Expand All @@ -51,21 +63,23 @@
"@typescript-eslint/array-type": ["error", { // string[] instead of Array<string>
"default": "array-simple"
}],
"@typescript-eslint/ban-types": "error", // bans types like String in favor of string
"@typescript-eslint/indent": "error", // consistent indentation
"@typescript-eslint/no-wrapper-object-types": "error", // bans types like String in favor of string

// FIXME now from @stylistic/indent plugin : "@typescript-eslint/indent": "error", // consistent indentation
"@typescript-eslint/no-explicit-any": "error", // don't use :any type
"@typescript-eslint/no-misused-new": "error", // no constructors for interfaces or new for classes
"@typescript-eslint/no-namespace": "off", // disallow the use of custom TypeScript modules and namespaces
"@typescript-eslint/no-non-null-assertion": "off", // allow ! operator
"@typescript-eslint/no-parameter-properties": "error", // no property definitions in class constructors
"@typescript-eslint/parameter-properties": "error", // no property definitions in class constructors
"@typescript-eslint/no-unused-vars": ["error", { // disallow Unused Variables
"argsIgnorePattern": "^_"
}],
"@typescript-eslint/no-var-requires": "error", // use import instead of require
"@typescript-eslint/prefer-for-of": "error", // prefer for-of loop over arrays
"@typescript-eslint/prefer-namespace-keyword": "error", // prefer namespace over module in TypeScript
"@typescript-eslint/triple-slash-reference": "error", // ban /// <reference />, prefer imports
"@typescript-eslint/type-annotation-spacing": "error", // consistent space around colon ':'
// FIXME now from @stylistic/indent plugin : "@typescript-eslint/type-annotation-spacing": "error", // consistent space around colon ':'
"@typescript-eslint/consistent-type-imports": "error"
}
}
;
2 changes: 1 addition & 1 deletion examples/calico-colors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"build": "npm run compile",
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./ && npm run browserify",
"lint": "eslint . --ext .ts,.tsx",
"lint": "eslint src",
"browserify": "browserify ./media/calico-colors/main.js > ./media/web-view-bundle-calico-colors.js && browserify ./media/coding-cat/main.js > ./media/web-view-bundle-coding-cat.js",
"watch": "tsc -w -p ./"
},
Expand Down
Loading

0 comments on commit 896cee9

Please sign in to comment.