Skip to content
This repository was archived by the owner on Oct 31, 2023. It is now read-only.

Commit a7a6b54

Browse files
committed
Release 4.0.0
1 parent b563cfa commit a7a6b54

File tree

7 files changed

+67
-34
lines changed

7 files changed

+67
-34
lines changed

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ The Universal Permissive License (UPL), Version 1.0*
88
We plan to provide this functionality in the future. At that time, you will need to follow [The Oracle Contributor Agreement](https://www.oracle.com/technetwork/community/oca-486395.html)
99
(OCA).
1010

11-
If you have ideas, comments, or issues related to generator, swing on by the [Oracle JET discussion forum.](https://community.oracle.com/community/development_tools/oracle-jet/generators)
11+
If you have ideas, comments, or issues to discuss, swing on by the [Oracle JET discussion forum.](https://community.oracle.com/community/development_tools/oracle-jet/generators)
1212

README.md

+47-19
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
# eslint-config-oraclejet 3.2.0
1+
# @oracle/eslint-config-oraclejet 4.0.0
22

33
This package contains the ESLint configurations used by the Oracle JET project. These configurations come in two flavors:
44

55
* es5: this configuration is used by the JET runtime code base, which is authored in ES5.
66
* es6: this configuration is used by the JET tooling code base, which consists of a collection of Node-based packages that are authored in ES6.
77

8-
These ESLint configurations are based on the [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript), which defines thorough JavaScript coding guidelines with the goal of ensuring a clean, consistent code base. The Oracle JET configurations introduce some deltas on top of the base ESLint configurations defined by Airbnb, as explained below.
8+
These ESLint configurations are based on the [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript), which defines thorough JavaScript coding guidelines with the goal of ensuring a clean, consistent code base. The Oracle JET configurations introduce some deltas on top of the base ESLint configurations provided by Airbnb, as explained below.
99

10-
Application developers are welcome to use the Oracle JET ESLint configurations with their own code bases, though be aware that several of the changes are fairly specific to JET (eg. use of underscore prefixes), so please review the changes below before adoption. A better option for JET-based applications that want to follow a similar coding standard without picking up the JET-specific quirks would be to use [Airbnb's ESLint configurations](https://www.npmjs.com/package/eslint-config-airbnb) directly.
10+
Application developers are welcome to use the Oracle JET ESLint configurations with their own code bases, though be aware that several of the changes are fairly specific to JET (e.g. use of underscore prefixes), so please review the information below before adoption. A better option for JET-based applications that want to follow a similar coding standard without picking up the JET-specific quirks would be to use [Airbnb's ESLint configurations](https://www.npmjs.com/package/eslint-config-airbnb) directly.
1111

1212
## Deltas to the Airbnb ESLint Configurations
1313

1414
The following sections list the modifications that the Oracle JET ESLint configurations apply on top of the base Airbnb configurations.
1515

1616
### 1. Common Deltas
1717

18-
The items in this section apply to both our ES5 and ES6 configurations.
18+
The items in this section apply to both of our configurations (ES5 and ES6).
1919

2020
#### 1.1 Underscore prefixes are used for private variables
2121

@@ -29,47 +29,75 @@ The JET team is evaluating other [approaches to private properties](https://curi
2929

3030
_ESLint rule change_: [func-names](http://eslint.org/docs/rules/func-names) is disabled.
3131

32-
The Airbnb ESLint rules enforce that all function expressions must be named. This requires duplication when assigning function expressions, eg:
32+
The Airbnb ESLint rules enforce that all function expressions must be named. This requires duplication when assigning function expressions, e.g.:
3333

3434
```javascript
3535
Foo.prototype.doSomething = function doSomething() { };
3636
```
3737

3838
Given that ES6 specifies new rules for [function name inference](http://www.ecma-international.org/ecma-262/6.0/#sec-assignment-operators-runtime-semantics-evaluation), the JET code base allows anonymous function expressions.
3939

40-
Note that while modern browsers support function name inference, the use of anonymous function expressions can make debugging more challenging on older browsers (eg. IE11).
40+
Note that while modern browsers support function name inference, the use of anonymous function expressions can make debugging more challenging on older browsers (e.g. IE11).
4141

42-
#### 1.3 Functions may be called before they are defined.
42+
#### 1.3 Functions may be used before they are defined (in non-hoisting situations)
4343

4444
_ESLint rule change_: [no-use-before-define](http://eslint.org/docs/rules/no-use-before-define) is disabled for functions.
4545

4646
Robert Martin's [Clean Code](https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882) promotes the notion that code should read like a top-down narrative, where higher level functions appear at the top of the module, followed by functions of increasingly lower levels of abstraction that are used to implement the preceding higher level functions. This approach to code organization is dubbed "The Stepdown Rule".
4747

48-
The JET team likes this rule enough to justify disabling the no-use-before-define rule defined by Airbnb's ESLint config. (We disable the rule just for functions, not for variables).
48+
Unfortunately, the no-use-before-define ESLint rule is not compatible with this approach.
4949

50-
#### 1.4. Function declarations are allowed.
50+
In theory, no-use-before-define intends to protect developers from relying on function hoisting behavior like this:
51+
52+
```javascript
53+
// Call function that has not yet been defined
54+
doSomething();
55+
56+
// Define function somewhere later in the same scope
57+
function doSomething() { }
58+
```
59+
The above code relies on the fact that the definition of the doSomething function will be hoisted to the top of the scope, above the doSomething() call. This is reasonable to flag.
60+
61+
However, the no-use-before-define rule additionally reports the following code as a violation:
62+
63+
```javascript
64+
function doSomething() {
65+
doSomeLowerLevelThing();
66+
}
67+
68+
function doSomeLowerLevelThing() {}
69+
```
70+
71+
Although the above code does not rely on function hoisting, no-use-before-define still considers this code to be invalid, which prohibits the use of Martin's Stepdown Rule.
72+
73+
The JET team likes the Stepdown Rule enough to justify disabling the no-use-before-define rule defined by Airbnb's ESLint config. (We disable the rule just for functions, not for variables.)
74+
75+
If in the future we find (or implement) an ESLint rule that can distinguish between hoisting-dependent vs. hoisting-independent usages, we may start treating hoisting-dependent use-before-define cases as violations. As such, we encourage JET developers to limit reliance on function hoisting, even though this is not currently enforced.
76+
77+
78+
#### 1.4. Function declarations are allowed
5179

5280
_ESLint rule change_: None.
5381

54-
The Airbnb style guide prefers the use of [function expressions instead of function declarations](https://github.com/airbnb/javascript#functions--declarations) due to concerns over confusion relating to function [hoisting](http://www.adequatelygood.com/JavaScript-Scoping-and-Hoisting.html).
82+
The Airbnb style guide prefers the use of [function expressions instead of function declarations](https://github.com/airbnb/javascript#functions--declarations) due to concerns over function [hoisting](http://www.adequatelygood.com/JavaScript-Scoping-and-Hoisting.html) confusion.
5583

56-
We have found function declarations to be reasonably readable and have not had problems with function declaration hoisting confusion. As such, we continue to use this language feature.
84+
We have found function declarations to be readable and have increased complexity in our code base. As such, we continue to leverage this language feature.
5785

5886
Note that it appears that Airbnb eventually plans to enforce the use of function expressions via the [func-style](http://eslint.org/docs/rules/func-style) rule. However, this is not yet enforced, so JET does not yet make any rule changes relating to this.
5987

6088
#### 1.5 Platform-specific line breaks are allowed
6189

6290
_ESLint rule change_: [linebreak-style](http://eslint.org/docs/rules/linebreak-style) is disabled.
6391

64-
Rather than enforce a consistent line break style via ESLint, we prefer to deal with this at the source control layer. This allows our developers to do development on their platform of choice (including running ESLint).
92+
Rather than enforce a consistent line break style via ESLint, we prefer to deal with this at the source control layer. This allows our developers to do development (including running ESLint) on their platform of choice without having to worry about line breaks.
6593

66-
#### 1.6 The unary increment/decrement operators may be used in for loops.
94+
#### 1.6 The unary increment/decrement operators may be used in for loops
6795

6896
_ESLint rule change_: [no-plusplus](http://eslint.org/docs/rules/no-plusplus) is disabled for afterthoughts in for loops.
6997

7098
The Airbnb style guide raises various [concerns about the use of ++ and --](https://github.com/airbnb/javascript#variables--unary-increment-decrement). While we agree with these concerns, we are comfortable with allowing these operators in for loops.
7199

72-
Note that, like Airbnb, we prefer [higher-order functions instead of loops](https://github.com/airbnb/javascript#iterators--nope). But for the few places where we do loop, we are okay with seeing increment/decrement operators.
100+
Note that, like Airbnb, we prefer [higher-order functions instead of loops](https://github.com/airbnb/javascript#iterators--nope).
73101

74102
### 2. ES6-specific Deltas
75103

@@ -79,7 +107,7 @@ The following changes are specific to the ES6 version of the Oracle JET ESLint c
79107

80108
_ESLint rule change_: [no-console](http://eslint.org/docs/rules/no-console) is disabled.
81109

82-
For the moment, our ES6 configuration is exclusively used by JET's Node-based tooling modules. These modules use console logging to communicate with the end user.
110+
For the moment, our ES6 configuration is exclusively used by JET's Node-based tooling modules. These modules use console logging to communicate with the end user.
83111

84112
Note we are considering generalizing our ES6 rules to apply to browser code as well, in which case we would change to (globally) disallowing console logging.
85113

@@ -93,13 +121,13 @@ The Airbnb ESLint config forbids the use of 'use strict' as Airbnb relies on [Ba
93121

94122
_ESLint rule change_: [comma-dangle](http://eslint.org/docs/rules/comma-dangle) is disabled.
95123

96-
Airbnb's (ES6) style guide mandates the use of dangling commas for the purpose of having cleaner git diffs. We find that dangling commas can be slightly less readable/more confusing for developers, so we prefer to optimize for reading over dif'fing.
124+
Airbnb's (ES6) style guide mandates the use of dangling commas for the purpose of having cleaner git diffs. We find that dangling commas can be slightly less readable and slightly more confusing for developers, so we prefer to optimize for reading over diff'ing.
97125

98126
#### 2.4 Unresolved imports are (temporarily) allowed
99127

100128
_ESLint rule change_: [import/no-unresolved](http://eslint.org/docs/rules/import/no-unresolved) is disabled.
101129

102-
While we would like to leave this rule enabled, we are currently seeing some seemingly false positives trigger by this rule. We are temporarily disabling this while we get to the bottom of the violations.
130+
While we would like to leave this rule enabled, we are currently seeing some false positives triggered by this rule. As such, we are temporarily disabling this while we get to the bottom of the violations. We plan to re-enable this rule in a future version of our eslint-config-oraclejet.
103131

104132
### 3. ES5-specific Deltas
105133

@@ -109,9 +137,9 @@ The following changes are specific to the ES5 version of the Oracle JET ESLint c
109137

110138
_ESLint rule change_: [quote-props](http://eslint.org/docs/rules/import/quote-props) and [dot-notation](http://eslint.org/docs/rules/dot-notation) are disabled.
111139

112-
Like Airbnb, we strongly prefer dot notation over quoting. However, the JET code base uses quoting as a way to ensure that the Closure Compiler does not mangle certain property names. Rather than suppress each of these violations locally each time the quoted property is referenced, we decided to disable these two ESLint rules.
140+
Like Airbnb, we strongly prefer dot notation over quoting. However, the JET runtime code base uses quoting as a way to ensure that the Closure Compiler does not mangle certain property names. Rather than suppress each of these violations locally each time the quoted property is referenced, we decided to disable these two ESLint rules globally.
113141

114-
We would recommend that teams building JET-based applications use dot notation and leave these two rules enabled.
142+
We may re-enable both of these rules in the future, and as such encourage the use of dot notation wherever possible.
115143

116144
## [Contributing](https://github.com/oracle/eslint-config-oraclejet/tree/master/CONTRIBUTING.md)
117145
Oracle JET is an open source project. Pull Requests are currently not being accepted. See [CONTRIBUTING](https://github.com/oracle/eslint-config-oraclejet/tree/master/CONTRIBUTING.md) for details.

RELEASENOTES.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## Release Notes for eslint-config-oraclejet ##
22

3+
### 4.0.0
4+
* Moved module into @oracle scope, changing the name to @oracle/eslint-config-oraclejet
5+
36
### 3.2.0
47
* No changes
58

es5/base.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ module.exports = {
2424
"no-use-before-define" : ["error", {"functions" : false, "classes" : true}],
2525
"no-plusplus": ["error", {"allowForLoopAfterthoughts": true }],
2626
"no-underscore-dangle": "off",
27-
"quote-props": "off"
27+
"quote-props": "off",
2828
}
2929
}

es6/base.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ module.exports = {
1616
"no-console" : "off",
1717
"no-plusplus": ["error", {"allowForLoopAfterthoughts": true }],
1818
"no-use-before-define" : ["error", {"functions" : false, "classes" : true}],
19-
"strict" : "off"
19+
"strict" : "off",
2020
}
2121
};

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Default config
66
module.exports = {
77
extends: [
8-
'./es6/base'
8+
'./es5/base'
99
].map(require.resolve),
1010
rules: {}
1111
};

package.json

+13-11
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
{
2-
"name": "eslint-config-oraclejet",
3-
"version": "3.2.0",
2+
"name": "@oracle/eslint-config-oraclejet",
3+
"version": "4.0.0",
44
"license": "UPL-1.0",
55
"description": "JET Coding standards eslint config files",
66
"keywords": [
77
"eslint",
88
"eslintconfig"
9-
],
9+
],
1010
"homepage": "http://oraclejet.org",
1111
"files": [
1212
"es5",
1313
"es6",
1414
"*.js"
1515
],
16-
"dependencies":
17-
{
18-
"eslint-config-airbnb-base": "^10.0.1",
19-
"eslint-plugin-import": "^2.2.0"
16+
"dependencies": {
17+
"eslint": "~3.19.0",
18+
"eslint-config-airbnb": "~14.1.0",
19+
"eslint-config-airbnb-base": "~11.1.2",
20+
"eslint-plugin-import": "~2.2.0",
21+
"eslint-plugin-react": "~6.10.3",
22+
"eslint-plugin-jsx-a11y": "~4.0.0"
2023
},
21-
"devDependencies":
22-
{
23-
"fs-extra": "^2.0.0"
24+
"devDependencies": {
25+
"fs-extra": "~2.1.2"
2426
},
25-
"jetdocversion": "320"
27+
"jetdocversion": "400"
2628
}

0 commit comments

Comments
 (0)