Skip to content

Commit

Permalink
Move source to folder & Replace standardx with eslint & Update .npmig…
Browse files Browse the repository at this point in the history
…nore (#321)

* Move all source code files to a new `src` folder to improve structure
of the repo.
* Replace `standardx` linter with `eslint` using the standard rules.
This allows more flexibility and works around the fact, that `standardx`
seems outdated regarding our eslint version.
* Update .npmignore to exclude more development related files and
therefore decrease package size by a few kilobytes.

---------

Signed-off-by: Florian Hotze <[email protected]>
  • Loading branch information
florian-h05 authored Jan 20, 2024
1 parent 903599f commit 384f5fe
Show file tree
Hide file tree
Showing 67 changed files with 2,501 additions and 2,601 deletions.
10 changes: 0 additions & 10 deletions .eslintrc

This file was deleted.

14 changes: 14 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
extends: 'eslint-config-standard',
rules: {
semi: ["error", "always"],
"no-extra-semi": "error",
"func-style": ["error", "declaration", { "allowArrowFunctions": true }]
},
globals: {
Java: "readonly"
},
parserOptions: {
ecmaVersion: 2022
}
}
23 changes: 13 additions & 10 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@

.github
.idea
.markdownlint.yaml
.vscode
CODEOWNERS
coverage
DEPLOY.md
build
dist
doc
docs
docs_config.json
dist
images
jest.config.js
openhab-*.tgz
out
test

types/index.d.ts*

.eslintrc.js
.gitignore
.markdownlint.yaml
.nvmrc
CODEOWNERS
CONTRIBUTING.md
DEPLOY.md
openhab-*.tgz
typeOfArguments.js
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ After you read the following sections, please read the [deployment instructions]

### Code style

openhab-js is using [`standardx`](https://github.com/standard/standardx) for code linting and formatting.
openhab-js is using [`eslint`](https://eslint.org/) with the rules from [JavaScript standard style](https://standardjs.com/) and some overrides for code linting and formatting.

Code-style is enforced when checks run on a PR.

Expand Down
2 changes: 1 addition & 1 deletion build/@openhab-globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

(function (global) {
'use strict';
Object.assign(globalThis, require('../index'));
Object.assign(globalThis, require('../src/index'));
// Support legacy NodeJS libraries
globalThis.global = globalThis;
})(this);
2 changes: 1 addition & 1 deletion build/jsdoc.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"template": "./node_modules/docdash"
},
"docdash": {
"sort": false,
"sort": true,
"static": true,
"sectionOrder": [
"Namespaces",
Expand Down
2 changes: 1 addition & 1 deletion build/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
// Change this to match your project
"include": ["../**/*.js"],
"include": ["../src/**/*.js"],
"exclude": [
"../test/**",
"../coverage/**",
Expand Down
2 changes: 1 addition & 1 deletion build/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');

module.exports = {
entry: './index.js',
entry: './src/index.js',
mode: 'production',
performance: {
hints: false,
Expand Down
Loading

0 comments on commit 384f5fe

Please sign in to comment.