diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index f3e045656..000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,24 +0,0 @@ -module.exports = { - 'env': { - 'browser': true, - 'amd': true, - 'commonjs': true - }, - 'parserOptions': { - 'ecmaVersion': 6 - }, - 'globals': { - 'Tracy': true - }, - 'extends': 'eslint:recommended', - 'rules': { - 'indent': ['error', 'tab'], - 'quotes': ['error', 'single'], - 'semi': ['error', 'always'], - 'func-style': ['error', 'expression'], - 'prefer-arrow-callback': ['error'], - 'arrow-parens': ['error'], - 'arrow-spacing': ['error'], - 'no-var': ['error'] - } -}; diff --git a/.github/workflows/coding-style.yml b/.github/workflows/coding-style.yml index cf3857c62..2b5fe92c8 100644 --- a/.github/workflows/coding-style.yml +++ b/.github/workflows/coding-style.yml @@ -36,4 +36,5 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - run: npm install - run: npx eslint src/assets/netteForms.js diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 000000000..f8a7e357b --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,30 @@ +import globals from 'globals'; +import pluginJs from '@eslint/js'; + +export default [ + pluginJs.configs.recommended, + { + languageOptions: { + ecmaVersion: 6, + globals: { + ...globals.browser, + 'Tracy': 'writeable', + 'define': 'readable', + 'module': 'readable', + }, + }, + ignores: ['**/*.min.js'], + rules: { + indent: ['error', 'tab'], + quotes: ['error', 'single'], + semi: ['error', 'always'], + 'func-style': ['error', 'expression'], + 'prefer-arrow-callback': ['error'], + 'arrow-parens': ['error'], + 'arrow-spacing': ['error'], + 'no-unused-vars': ['error', { + 'caughtErrors': 'none', + }], + }, + }, +]; diff --git a/package.json b/package.json index cbd649a3d..62de97d3f 100644 --- a/package.json +++ b/package.json @@ -1,21 +1,26 @@ { - "name": "nette-forms", - "version": "3.3.6", - "description": "Client side script for Nette Forms Component", - "keywords": [ - "nette", - "validation", - "forms" - ], - "homepage": "https://nette.org", - "author": "David Grudl (https://davidgrudl.com)", - "license": "BSD-3-Clause", - "main": "src/assets/netteForms.js", - "files": [ - "src/assets" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/nette/forms.git" - } + "name": "nette-forms", + "version": "3.3.6", + "description": "Client side script for Nette Forms Component", + "keywords": [ + "nette", + "validation", + "forms" + ], + "homepage": "https://nette.org", + "author": "David Grudl (https://davidgrudl.com)", + "license": "BSD-3-Clause", + "main": "src/assets/netteForms.js", + "files": [ + "src/assets" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/nette/forms.git" + }, + "devDependencies": { + "@eslint/js": "^9.1.1", + "eslint": "^9.1.1", + "globals": "^15.1.0" + } }