Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: merkle-open/eslint-config
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 9.0.2
Choose a base ref
...
head repository: merkle-open/eslint-config
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 8,120 additions and 6,077 deletions.
  1. +2 −2 .editorconfig
  2. +27 −0 .github/workflows/ci.yml
  3. +68 −0 .github/workflows/codeql-analysis.yml
  4. +1 −1 .node-version
  5. +0 −1 .nvmrc
  6. +3 −16 .prettierignore
  7. +1 −1 .prettierrc.js
  8. +2 −2 .prettierrc.unstyled.js
  9. +0 −8 .travis.yml
  10. +1 −1 LICENSE
  11. +41 −31 README.md
  12. +0 −24 appveyor.yml
  13. +1 −1 bin/.eslintrc.js
  14. +49 −0 bin/identify-undefined-rules.js
  15. +0 −4 bin/utils.js
  16. +26 −18 bin/write-documentation.js
  17. +2 −6 bin/write-rule-test-files.js
  18. +2 −5 configurations/es5-browser-disable-styles.js
  19. +2 −5 configurations/es5-browser.js
  20. +1 −2 configurations/es5-disable-styles.js
  21. +1 −1 configurations/es5-node-disable-styles.js
  22. +1 −1 configurations/es5-node.js
  23. +2 −2 configurations/es5.js
  24. +2 −5 configurations/es6-browser-disable-styles.js
  25. +2 −5 configurations/es6-browser.js
  26. +1 −2 configurations/es6-disable-styles.js
  27. +1 −1 configurations/es6-node-disable-styles.js
  28. +1 −2 configurations/es6-node.js
  29. +2 −3 configurations/es6-react-disable-styles.js
  30. +25 −31 configurations/es6-react.js
  31. +3 −5 configurations/es6.js
  32. +2 −5 configurations/es7-browser-disable-styles.js
  33. +2 −4 configurations/es7-browser.js
  34. +1 −2 configurations/es7-disable-styles.js
  35. +1 −2 configurations/es7-node-disable-styles.js
  36. +1 −2 configurations/es7-node.js
  37. +2 −3 configurations/es7-react-disable-styles.js
  38. +29 −31 configurations/es7-react.js
  39. +3 −5 configurations/es7.js
  40. +2 −5 configurations/es8-browser-disable-styles.js
  41. +2 −4 configurations/es8-browser.js
  42. +1 −2 configurations/es8-disable-styles.js
  43. +1 −2 configurations/es8-node-disable-styles.js
  44. +1 −2 configurations/es8-node.js
  45. +2 −3 configurations/es8-react-disable-styles.js
  46. +29 −32 configurations/es8-react.js
  47. +3 −6 configurations/es8.js
  48. +1 −3 configurations/typescript-browser-disable-styles.js
  49. +1 −3 configurations/typescript-browser.js
  50. +0 −2 configurations/typescript-disable-styles.js
  51. +0 −1 configurations/typescript-node-disable-styles.js
  52. +1 −1 configurations/typescript-react-disable-styles.js
  53. +5 −0 configurations/typescript-react.js
  54. +8 −15 configurations/typescript.js
  55. +0 −45 dash4.config.js
  56. +20 −20 documentation/imports.md
  57. +16 −16 documentation/react-a11y.md
  58. +46 −46 documentation/react.md
  59. +41 −79 documentation/typescript.md
  60. +4 −4 documentation/with-prettier.md
  61. +6,999 −5,110 package-lock.json
  62. +37 −38 package.json
  63. +16 −17 rules/best-practices.js
  64. +0 −1 rules/errors-disable-styles.js
  65. +32 −26 rules/errors.js
  66. +0 −1 rules/es6-disable-styles.js
  67. +36 −21 rules/es6.js
  68. +0 −1 rules/es8-disable-styles.js
  69. +0 −1 rules/es8.js
  70. +2 −4 rules/imports-disable-styles.js
  71. +35 −34 rules/imports.js
  72. +0 −1 rules/node-disable-styles.js
  73. +0 −1 rules/node.js
  74. +16 −16 rules/react-a11y.js
  75. +10 −11 rules/react-disable-styles.js
  76. +114 −91 rules/react.js
  77. +0 −1 rules/style-disable-styles.js
  78. +44 −29 rules/style.js
  79. +46 −0 rules/typescript-disable-styles.js
  80. +128 −79 rules/typescript.js
  81. +0 −1 rules/variables-disable-styles.js
  82. +0 −1 rules/variables.js
  83. +2 −2 test/es5-node/.eslintrc.js
  84. +1 −1 test/es5/.eslintrc.js
  85. +3 −3 test/es6-react-disable-styles/rules/react/sort-comp.js
  86. +1 −1 test/es6-react/.eslintrc.js
  87. +3 −3 test/es6-react/rules/react/sort-comp.js
  88. +2 −2 test/es6/.eslintrc.js
  89. +1 −1 test/es7/.eslintrc.js
  90. +1 −1 test/es8/.eslintrc.js
  91. +4 −4 test/typescript-disable-styles/.eslintrc.js
  92. +1 −0 test/typescript-disable-styles/__tests__/indent.ts
  93. +1 −0 test/typescript-disable-styles/__tests__/member-delimiter-style.ts
  94. +3 −0 test/typescript-react-disable-styles/.eslintrc.js
  95. +19 −0 test/typescript-react-disable-styles/__tests__/Input.tsx
  96. +3 −0 test/typescript-react/.eslintrc.js
  97. +26 −0 test/typescript-react/__tests__/Input.tsx
  98. +1 −1 test/typescript/.eslintrc.js
  99. +29 −0 test/typescript/__tests__/no-shadow.ts
  100. +1 −0 test/typescript/rules/typescript/adjacent-overload-signatures.ts
  101. +1 −0 test/typescript/rules/typescript/array-type.ts
  102. +1 −1 test/typescript/rules/typescript/consistent-type-assertions.ts
  103. +1 −1 test/typescript/rules/typescript/no-extraneous-class.ts
  104. +1 −1 test/typescript/rules/typescript/no-misused-new.ts
  105. +0 −35 test/typescript/rules/typescript/no-parameter-properties.ts
  106. +2 −2 test/typescript/rules/typescript/prefer-function-type.ts
  107. +2 −2 tsconfig.json
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# EditorConfig. Frontend. Default. Namics.
# EditorConfig. Frontend. Default. Merkle.
# @see: http://EditorConfig.org
# install a plugin to your editor: http://editorconfig.org/#download
# mark: not all plugins supports the same EditorConfig properties
@@ -35,4 +35,4 @@ indent_size = 2
### Specific files
[{package,bower,lerna}.json]
indent_style = space
indent_size = 2
indent_size = 2
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This workflow will do a clean install of node dependencies and run tests across different versions of node on different environments
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: ci
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
name: Test - ${{ matrix.platform }} - Node v${{ matrix.node-version }}
strategy:
matrix:
node-version: [ 18.x, 20.x ]
platform: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm test
68 changes: 68 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
# ******** NOTE ********

name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '29 21 * * 0'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.18.3
20.15.1
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

19 changes: 3 additions & 16 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -3,19 +3,6 @@
**/package.json
**/package-lock.json

# Generated
**/bower.json
**/lerna.json

# Build
**/build
**/dist
**/public
**/coverage
**/storybook-static

# Nitro
**/project/blueprints
**/.yo-rc.json

test/typescript-disable-styles/__tests__/member-delimiter-style.ts
# Project
test/typescript-disable-styles/__tests__/member-delimiter-style.ts
test/typescript-react
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require("@namics/prettier-config");
module.exports = require('@merkle-open/prettier-config');
4 changes: 2 additions & 2 deletions .prettierrc.unstyled.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const config = require('@namics/prettier-config');
const config = require('@merkle-open/prettier-config');
module.exports = Object.assign(config, {
printWidth: 400,
tabWidth: 2,
useTabs: false,
singleQuote: false,
trailingComma: 'none',
bracketSpacing: false,
jsxBracketSameLine: false,
bracketSameLine: false,
arrowParens: 'avoid',
});
8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016-2018 Namics AG
Copyright (c) 2015 Merkle Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
72 changes: 41 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
# ESLint config Namics
# ESLint config

[![Build Status](https://img.shields.io/travis/namics/eslint-config-namics/master.svg)](https://travis-ci.org/namics/eslint-config-namics)
[![Build status](https://ci.appveyor.com/api/projects/status/o2ka9gbhm1ry6kjm/branch/master?svg=true)](https://ci.appveyor.com/project/namics/eslint-config-namics/branch/master)
[![npm](https://img.shields.io/npm/v/@namics/eslint-config.svg)](https://www.npmjs.com/package/@namics/eslint-config)
[![Codestyle](https://img.shields.io/badge/codestyle-namics-green.svg)](https://github.com/namics/eslint-config-namics)
[![Build Status](https://github.com/merkle-open/eslint-config/workflows/ci/badge.svg)](https://github.com/merkle-open/eslint-config/actions)
[![npm](https://img.shields.io/npm/v/@merkle-open/eslint-config.svg)](https://www.npmjs.com/package/@merkle-open/eslint-config)
[![Codestyle](https://img.shields.io/badge/codestyle-merkle-green.svg)](https://github.com/merkle-open/eslint-config)

## Installation

```bash
$ npm install --save-dev eslint eslint-plugin-import @namics/eslint-config
$ npm install --save-dev eslint eslint-plugin-import @merkle-open/eslint-config
```

## Usage Typescript (recommended)

- `@namics/eslint-config/configurations/typescript-browser` - typescript + browser
- `@namics/eslint-config/configurations/typescript-react` - typescript + react
- `@namics/eslint-config/configurations/typescript-node` - typescript + node
- `@merkle-open/eslint-config/configurations/typescript-browser` - typescript + browser
- `@merkle-open/eslint-config/configurations/typescript-react` - typescript + react
- `@merkle-open/eslint-config/configurations/typescript-node` - typescript + node

*package.json*
_package.json_

```json
{
@@ -27,7 +26,7 @@ $ npm install --save-dev eslint eslint-plugin-import @namics/eslint-config
}
```

*Enabling ESLint on TS files in VSCode*
_Enabling ESLint on TS files in VSCode_

You need to update the eslint.validate setting to:

@@ -42,21 +41,21 @@ You need to update the eslint.validate setting to:

## Usage ES8 (ES2017)

- `@namics/eslint-config/configurations/es8-browser` - ES8 + browser
- `@namics/eslint-config/configurations/es8-react` - ES8 + react
- `@namics/eslint-config/configurations/es8-node` - ES8 + node
- `@merkle-open/eslint-config/configurations/es8-browser` - ES8 + browser
- `@merkle-open/eslint-config/configurations/es8-react` - ES8 + react
- `@merkle-open/eslint-config/configurations/es8-node` - ES8 + node

## Usage ES7 (ES2016)

- `@namics/eslint-config/configurations/es7-browser` - ES7 + browser (deprecated)
- `@namics/eslint-config/configurations/es7-react` - ES7 + react (deprecated)
- `@namics/eslint-config/configurations/es7-node` - ES7 + node
- `@merkle-open/eslint-config/configurations/es7-browser` - ES7 + browser (deprecated)
- `@merkle-open/eslint-config/configurations/es7-react` - ES7 + react (deprecated)
- `@merkle-open/eslint-config/configurations/es7-node` - ES7 + node

## Usage ES6 (ES2015) - deprecated

- `@namics/eslint-config/configurations/es6-browser` - ES6 + browser (deprecated)
- `@namics/eslint-config/configurations/es6-react` - ES6 + react (deprecated)
- `@namics/eslint-config/configurations/es6-node` - ES6 + node (deprecated)
- `@merkle-open/eslint-config/configurations/es6-browser` - ES6 + browser (deprecated)
- `@merkle-open/eslint-config/configurations/es6-react` - ES6 + react (deprecated)
- `@merkle-open/eslint-config/configurations/es6-node` - ES6 + node (deprecated)

## Usage with Prettier

@@ -66,7 +65,7 @@ You need to update the eslint.validate setting to:

```
module.exports = {
extends: require.resolve('@namics/eslint-config/configurations/es8-browser.js'),
extends: require.resolve('@merkle-open/eslint-config/configurations/es8-browser.js'),
};
```

@@ -85,20 +84,21 @@ module.exports = {
"lint:js": "eslint ."
},
```

then run `npm run lint`

### Example usage in project tree

- .eslintrc.js (es8-react)
- .eslintignore
- src
- app.jsx
- app.jsx
- test
- .eslintrc.js (es8-node)
- index.js
- .eslintrc.js (es8-node)
- index.js
- scripts
- .eslintrc.js (es6-node)
- index.js
- .eslintrc.js (es6-node)
- index.js

## Documentation

@@ -115,17 +115,27 @@ then run `npm run lint`
- [React hooks](./documentation/react-hooks.md) (ES6/7/8)
- [Typescript](./documentation/typescript.md) (typescript)

## Build release

1. Create feature or bugfix branch based on master
2. Make changes and create pull request, add reviewer, wait for approval
3. Merge pull request into master
4. Prepare release notes, adjust package.json to next version ([Semantic Versioning](semantic versioning))
5. Run `npm publish` (locally) to create npm version
6. Create and push git tag for version
7. Add release notes on GitHub

## Thanks to

* [Namics.](https://www.namics.com/en/)
* [ESLint](https://github.com/eslint/eslint) for ESLint and the documentation [eslint.org](http://eslint.org/)
* [Walmart](https://github.com/walmartlabs) for sharing their config in [eslint-config-walmart](https://github.com/walmartlabs/eslint-config-walmart)
* [AirBnB](https://github.com/airbnb) for sharing their eslint config in [JavaScript Style Guide](https://github.com/airbnb/javascript)
- [Merkle](https://www.merkleinc.ch/)
- [ESLint](https://github.com/eslint/eslint) for ESLint and the documentation [eslint.org](http://eslint.org/)
- [Walmart](https://github.com/walmartlabs) for sharing their config in [eslint-config-walmart](https://github.com/walmartlabs/eslint-config-walmart)
- [AirBnB](https://github.com/airbnb) for sharing their eslint config in [JavaScript Style Guide](https://github.com/airbnb/javascript)

## License

[MIT License](./LICENSE)

## Changelog

Please see the [Releases](https://github.com/namics/eslint-config-namics/releases)
Please see the [Releases](https://github.com/merkle-open/eslint-config/releases)
24 changes: 0 additions & 24 deletions appveyor.yml

This file was deleted.

2 changes: 1 addition & 1 deletion bin/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
"extends": "../configurations/es5-node.js"
extends: ['../configurations/es5-node.js', '../configurations/es5-node-disable-styles.js'].map(require.resolve),
};
49 changes: 49 additions & 0 deletions bin/identify-undefined-rules.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* eslint-disable no-console */
const path = require('path');
const fs = require('fs').promises;
// eslint-disable-next-line no-redeclare
const fetch = require('node-fetch');

const appendPrefix = (prefix) => (val) => `${prefix}${val}`;
const ruleNotDefined = (ruleSet) => (val) => Boolean(!ruleSet[val]);
const prettyPrint = (val) => `- ${val}`;

/**
* @param {string} pathRules - path to the rule js file
* @param {string} url - url: for example https://github.com/eslint/eslint/tree/master/docs/rules
* @param {string} prefix - rule prefix for example "@typescript-eslint/"
* @returns {void}
*/
async function identifyUndefinedRules(pathRules, url, prefix) {
const cwd = await fs.realpath(process.cwd());
// eslint-disable-next-line global-require
const rulesFile = await require(path.join(cwd, pathRules));
const checkForRules = [];
const checkForFile = await (await fetch(url)).text();

const regex1 = /([^>]*)(\.md)(<\/a>)/g;
let arr;

// eslint-disable-next-line no-cond-assign
while ((arr = regex1.exec(checkForFile)) !== null) {
checkForRules.push(appendPrefix(prefix)(arr[1]));
}

const missingRules = checkForRules.filter(ruleNotDefined(rulesFile.rules));

if (missingRules.length <= 0) {
console.log('All rules are defined');
}

console.log(`\nThe following ${missingRules.length} rules are not defined:\n`);
console.log(missingRules.map(prettyPrint).join('\n'));
}

// eslint: https://github.com/eslint/eslint/tree/master/docs/rules
// typescript: https://github.com/eslint/eslint/tree/master/docs/rules

identifyUndefinedRules(
'./rules/typescript.js',
'https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin/docs/rules',
'@typescript-eslint/'
);
Loading